diff options
author | V3n3RiX <venerix@koprulu.sector> | 2024-11-23 03:02:57 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2024-11-23 03:02:57 +0000 |
commit | 71dd9d29cdaf7cc0ecdb9ea37d128726a941c630 (patch) | |
tree | 4eccd905f575579fe47abb8a83bbdb44ceb8c929 /dev-python/ipython-genutils | |
parent | c7a7ec40cf928d8fc6a8241aa208272c008c7b4d (diff) |
gentoo auto-resync : 23:11:2024 - 03:02:56
Diffstat (limited to 'dev-python/ipython-genutils')
4 files changed, 322 insertions, 0 deletions
diff --git a/dev-python/ipython-genutils/Manifest b/dev-python/ipython-genutils/Manifest new file mode 100644 index 000000000000..ed3baaf76a16 --- /dev/null +++ b/dev-python/ipython-genutils/Manifest @@ -0,0 +1,4 @@ +AUX ipython-genutils-0.2.0-remove-nose.patch 8942 BLAKE2B 341047baeebfaa9317717da5674291c63f38630b14fb1f3252e672c8666c26588444c7d3242884c4e723d502ed14efc1a2e6ea58cea52d141f6383818c2042b6 SHA512 47c262744f7e24cea89c47114e8f061d77d6d992bac5f1ca3f33ac354680ff64d9df4503a0d0ca28340d1799bd0f5f6ec2693a17b4121fd3780690d48f26d4c0 +DIST ipython_genutils-0.2.0.tar.gz 22208 BLAKE2B 1a898e11cec26787f530f72e2d2a79e7834664e0f6be6a27ddd426bc2d0b3f39ee46e9ea10ad03e01a08054873c9752007038e863d7dd9e501613a68e40e1635 SHA512 0e5a9f8be17d98dfb74ec77d1360ee79276a13fe1914e6d31e8740f06375ed1671c49356a77f118495f50823b8384c1e2c5b6fae73965e3d4249c831b9a2b095 +EBUILD ipython-genutils-0.2.0-r4.ebuild 686 BLAKE2B 0efca82cf53c1c0b83b1ef39d8ddead4412af35e030387023bd1ded4764f50b19f6f05aea26b0b00ec17b517ed1db9277186f665f4537940a8ac66ec4abec9b8 SHA512 896c5e9c25909998803d462e98579adbdbf638833464dcb4b9c3b730efd304e365e2174bb49d141df97edea56e59e96389c31653848d36a94ab426ec60d5752c +MISC metadata.xml 862 BLAKE2B e520f2f567209b25e738b0ffddf7f6c636edd9c4f5a5dfe888009a48f23a73fbcc3c1c0d6ee9886d5b3b3969e1fcdc3cef7e6a9438228236ea3808446757df57 SHA512 b153b7a1d384236b7ac65738dd35d1b7a1557e3db72344a26e9c2a5f472ed971c8bce1787a507f140a85bd066daeade1d990b3b76b272354e18248de2f65c98e diff --git a/dev-python/ipython-genutils/files/ipython-genutils-0.2.0-remove-nose.patch b/dev-python/ipython-genutils/files/ipython-genutils-0.2.0-remove-nose.patch new file mode 100644 index 000000000000..a483aad330fa --- /dev/null +++ b/dev-python/ipython-genutils/files/ipython-genutils-0.2.0-remove-nose.patch @@ -0,0 +1,264 @@ +Use pytest instead of nose in testing & backend implementation + +https://build.opensuse.org/package/view_file/devel:languages:python:jupyter/python-ipython_genutils/denose.patch + +--- a/ipython_genutils/testing/decorators.py ++++ b/ipython_genutils/testing/decorators.py +@@ -35,6 +35,7 @@ import sys + import os + import tempfile + import unittest ++import pytest + + # For onlyif_cmd_exists decorator + from ..py3compat import string_types, which +@@ -131,81 +132,12 @@ def make_label_dec(label,ds=None): + # Inspired by numpy's skipif, but uses the full apply_wrapper utility to + # preserve function metadata better and allows the skip condition to be a + # callable. +-def skipif(skip_condition, msg=None): +- ''' Make function raise SkipTest exception if skip_condition is true +- +- Parameters +- ---------- +- +- skip_condition : bool or callable +- Flag to determine whether to skip test. If the condition is a +- callable, it is used at runtime to dynamically make the decision. This +- is useful for tests that may require costly imports, to delay the cost +- until the test suite is actually executed. +- msg : string +- Message to give on raising a SkipTest exception. +- +- Returns +- ------- +- decorator : function +- Decorator, which, when applied to a function, causes SkipTest +- to be raised when the skip_condition was True, and the function +- to be called normally otherwise. +- +- Notes +- ----- +- You will see from the code that we had to further decorate the +- decorator with the nose.tools.make_decorator function in order to +- transmit function name, and various other metadata. +- ''' +- +- def skip_decorator(f): +- # Local import to avoid a hard nose dependency and only incur the +- # import time overhead at actual test-time. +- import nose +- +- # Allow for both boolean or callable skip conditions. +- if callable(skip_condition): +- skip_val = skip_condition +- else: +- skip_val = lambda : skip_condition +- +- def get_msg(func,msg=None): +- """Skip message with information about function being skipped.""" +- if msg is None: out = 'Test skipped due to test condition.' +- else: out = msg +- return "Skipping test: %s. %s" % (func.__name__,out) +- +- # We need to define *two* skippers because Python doesn't allow both +- # return with value and yield inside the same function. +- def skipper_func(*args, **kwargs): +- """Skipper for normal test functions.""" +- if skip_val(): +- raise nose.SkipTest(get_msg(f,msg)) +- else: +- return f(*args, **kwargs) +- +- def skipper_gen(*args, **kwargs): +- """Skipper for test generators.""" +- if skip_val(): +- raise nose.SkipTest(get_msg(f,msg)) +- else: +- for x in f(*args, **kwargs): +- yield x +- +- # Choose the right skipper to use when building the actual generator. +- if nose.util.isgenerator(f): +- skipper = skipper_gen +- else: +- skipper = skipper_func +- +- return nose.tools.make_decorator(f)(skipper) +- +- return skip_decorator ++def skipif(skip_condition, msg=""): ++ return pytest.mark.skipif(skip_condition, reason=msg) + + # A version with the condition set to true, common case just to attach a message + # to a skip decorator +-def skip(msg=None): ++def skip(msg=""): + """Decorator factory - mark a test function for skipping from test suite. + + Parameters +@@ -219,7 +151,6 @@ def skip(msg=None): + Decorator, which, when applied to a function, causes SkipTest + to be raised, with the optional message added. + """ +- + return skipif(True,msg) + + +--- a/ipython_genutils/tests/test_importstring.py ++++ b/ipython_genutils/tests/test_importstring.py +@@ -3,25 +3,25 @@ + # Copyright (c) IPython Development Team. + # Distributed under the terms of the Modified BSD License. + +-import nose.tools as nt +- + from ..importstring import import_item + ++import pytest ++ ++ + def test_import_plain(): + "Test simple imports" + import os + os2 = import_item('os') +- nt.assert_true(os is os2) ++ assert os is os2 + + + def test_import_nested(): + "Test nested imports from the stdlib" + from os import path + path2 = import_item('os.path') +- nt.assert_true(path is path2) ++ assert path is path2 + + + def test_import_raises(): + "Test that failing imports raise the right exception" +- nt.assert_raises(ImportError, import_item, 'IPython.foobar') +- ++ pytest.raises(ImportError, import_item, 'IPython.foobar') +--- a/ipython_genutils/tests/test_path.py ++++ b/ipython_genutils/tests/test_path.py +@@ -5,15 +5,12 @@ + # Distributed under the terms of the Modified BSD License. + + import os +-import sys + import tempfile + +-import nose.tools as nt ++import pytest + +-from ..testing.decorators import skip_if_not_win32, skip_win32 +-from .. import path +-from .. import py3compat +-from ..tempdir import TemporaryDirectory ++from ipython_genutils.testing.decorators import skip_if_not_win32, skip_win32 ++from ipython_genutils import path + + + def test_filefind(): +@@ -22,20 +19,24 @@ def test_filefind(): + + + def test_ensure_dir_exists(): +- with TemporaryDirectory() as td: ++ with tempfile.TemporaryDirectory() as td: + d = os.path.join(td, u'∂ir') + path.ensure_dir_exists(d) # create it + assert os.path.isdir(d) + path.ensure_dir_exists(d) # no-op + f = os.path.join(td, u'ƒile') + open(f, 'w').close() # touch +- with nt.assert_raises(IOError): ++ with pytest.raises(IOError): + path.ensure_dir_exists(f) + + + class TestLinkOrCopy(object): ++ def __init__(self): ++ self.tempdir = None ++ self.src = None ++ + def setUp(self): +- self.tempdir = TemporaryDirectory() ++ self.tempdir = tempfile.TemporaryDirectory() + self.src = self.dst("src") + with open(self.src, "w") as f: + f.write("Hello, world!") +@@ -47,17 +48,17 @@ class TestLinkOrCopy(object): + return os.path.join(self.tempdir.name, *args) + + def assert_inode_not_equal(self, a, b): +- nt.assert_not_equals(os.stat(a).st_ino, os.stat(b).st_ino, +- "%r and %r do reference the same indoes" %(a, b)) ++ assert os.stat(a).st_ino != os.stat(b).st_ino, \ ++ "%r and %r do reference the same indoes" % (a, b) + + def assert_inode_equal(self, a, b): +- nt.assert_equals(os.stat(a).st_ino, os.stat(b).st_ino, +- "%r and %r do not reference the same indoes" %(a, b)) ++ assert os.stat(a).st_ino == os.stat(b).st_ino, \ ++ "%r and %r do not reference the same indoes" % (a, b) + + def assert_content_equal(self, a, b): + with open(a) as a_f: + with open(b) as b_f: +- nt.assert_equals(a_f.read(), b_f.read()) ++ assert a_f.read() == b_f.read() + + @skip_win32 + def test_link_successful(self): +@@ -105,4 +106,4 @@ class TestLinkOrCopy(object): + path.link_or_copy(self.src, dst) + path.link_or_copy(self.src, dst) + self.assert_inode_equal(self.src, dst) +- nt.assert_equal(sorted(os.listdir(self.tempdir.name)), ['src', 'target']) ++ assert sorted(os.listdir(self.tempdir.name)) == ['src', 'target'] +--- a/ipython_genutils/tests/test_text.py ++++ b/ipython_genutils/tests/test_text.py +@@ -5,12 +5,7 @@ from __future__ import print_function + # Copyright (c) IPython Development Team. + # Distributed under the terms of the Modified BSD License. + +-import os +-import math + import random +-import sys +- +-import nose.tools as nt + + from .. import text + +@@ -20,11 +15,11 @@ def test_columnize(): + size = 5 + items = [l*size for l in 'abc'] + out = text.columnize(items, displaywidth=80) +- nt.assert_equal(out, 'aaaaa bbbbb ccccc\n') ++ assert out == 'aaaaa bbbbb ccccc\n' + out = text.columnize(items, displaywidth=12) +- nt.assert_equal(out, 'aaaaa ccccc\nbbbbb\n') ++ assert out == 'aaaaa ccccc\nbbbbb\n' + out = text.columnize(items, displaywidth=10) +- nt.assert_equal(out, 'aaaaa\nbbbbb\nccccc\n') ++ assert out == 'aaaaa\nbbbbb\nccccc\n' + + def test_columnize_random(): + """Test with random input to hopfully catch edge case """ +@@ -48,12 +43,11 @@ def test_columnize_medium(): + size = 40 + items = [l*size for l in 'abc'] + out = text.columnize(items, displaywidth=80) +- nt.assert_equal(out, '\n'.join(items+[''])) ++ assert out == '\n'.join(items+['']) + + def test_columnize_long(): + """Test columnize with inputs longer than the display window""" + size = 11 + items = [l*size for l in 'abc'] + out = text.columnize(items, displaywidth=size-1) +- nt.assert_equal(out, '\n'.join(items+[''])) +- ++ assert out == '\n'.join(items+['']) diff --git a/dev-python/ipython-genutils/ipython-genutils-0.2.0-r4.ebuild b/dev-python/ipython-genutils/ipython-genutils-0.2.0-r4.ebuild new file mode 100644 index 000000000000..d1307d433838 --- /dev/null +++ b/dev-python/ipython-genutils/ipython-genutils-0.2.0-r4.ebuild @@ -0,0 +1,31 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYPI_PN=${PN/-/_} +PYTHON_COMPAT=( pypy3 python3_{10..13} ) + +inherit distutils-r1 pypi + +DESCRIPTION="Vestigial utilities from IPython" +HOMEPAGE=" + https://github.com/ipython/ipython_genutils/ + https://pypi.org/project/ipython_genutils/ +" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="amd64 arm arm64 hppa ~loong ppc ppc64 ~riscv ~s390 sparc x86" + +# Needed because package provides decorators which use pytest (after patch) +RDEPEND=" + dev-python/pytest[${PYTHON_USEDEP}] +" + +PATCHES=( + "${FILESDIR}/${P}-remove-nose.patch" +) + +distutils_enable_tests pytest diff --git a/dev-python/ipython-genutils/metadata.xml b/dev-python/ipython-genutils/metadata.xml new file mode 100644 index 000000000000..5cf2e5a822f8 --- /dev/null +++ b/dev-python/ipython-genutils/metadata.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>sci@gentoo.org</email> + <name>Gentoo Science Project</name> + </maintainer> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <stabilize-allarches/> + <longdescription> + This package contains some common utilities shared by Jupyter and + IPython projects during The Big Split. As soon as possible, those + packages will remove their dependency on this, and this repo will + go away. No packages outside IPython/Jupyter should depend on it. + </longdescription> + <upstream> + <remote-id type="pypi">ipython_genutils</remote-id> + <remote-id type="github">ipython/ipython_genutils</remote-id> + </upstream> +</pkgmetadata> |