- Fix denose.patch according to advice by Miro Hrončok on
gh#ipython/ipython_genutils#17. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:jupyter/python-ipython_genutils?expand=0&rev=10
This commit is contained in:
commit
c53b0b04ce
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
292
denose.patch
Normal file
292
denose.patch
Normal file
@ -0,0 +1,292 @@
|
||||
---
|
||||
ipython_genutils/testing/decorators.py | 85 ++--------------------------
|
||||
ipython_genutils/tests/test_importstring.py | 12 +--
|
||||
ipython_genutils/tests/test_path.py | 31 ++++------
|
||||
ipython_genutils/tests/test_text.py | 16 +----
|
||||
4 files changed, 33 insertions(+), 111 deletions(-)
|
||||
|
||||
--- 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
|
||||
@@ -84,9 +85,9 @@ def make_label_dec(label,ds=None):
|
||||
>>> slow = make_label_dec('slow')
|
||||
>>> slow.__doc__
|
||||
"Labels a test as 'slow'."
|
||||
-
|
||||
+
|
||||
And one that uses multiple labels and a custom docstring:
|
||||
-
|
||||
+
|
||||
>>> rare = make_label_dec(['slow','hard'],
|
||||
... "Mix labels 'slow' and 'hard' for rare tests.")
|
||||
>>> rare.__doc__
|
||||
@@ -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,8 +151,7 @@ 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)
|
||||
+ return skipif(True, msg)
|
||||
|
||||
|
||||
def onlyif(condition, msg):
|
||||
@@ -252,7 +183,7 @@ def module_not_available(module):
|
||||
|
||||
def decorated_dummy(dec, name):
|
||||
"""Return a dummy function decorated with dec, with the given name.
|
||||
-
|
||||
+
|
||||
Examples
|
||||
--------
|
||||
import IPython.testing.decorators as dec
|
||||
--- 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,42 +19,42 @@ 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 setUp(self):
|
||||
- self.tempdir = TemporaryDirectory()
|
||||
+ def setup_method(self):
|
||||
+ self.tempdir = tempfile.TemporaryDirectory()
|
||||
self.src = self.dst("src")
|
||||
with open(self.src, "w") as f:
|
||||
f.write("Hello, world!")
|
||||
|
||||
- def tearDown(self):
|
||||
+ def teardown_method(self):
|
||||
self.tempdir.cleanup()
|
||||
|
||||
def dst(self, *args):
|
||||
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 +102,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+[''])
|
BIN
ipython_genutils-0.2.0.tar.gz
(Stored with Git LFS)
Normal file
BIN
ipython_genutils-0.2.0.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
41
python-ipython_genutils.changes
Normal file
41
python-ipython_genutils.changes
Normal file
@ -0,0 +1,41 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 4 09:29:09 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
|
||||
|
||||
- Fix denose.patch according to advice by Miro Hrončok on
|
||||
gh#ipython/ipython_genutils#17.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 5 18:26:09 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Clean specfile from bogus requirements
|
||||
- Build PEP517 wheel
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 11 21:15:13 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add denose.patch to remove dependency on nose
|
||||
(gh#ipython/ipython_genutils#17).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 15 11:04:07 UTC 2020 - pgajdos@suse.com
|
||||
|
||||
- it requires python-nose in fact
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 30 17:53:28 UTC 2017 - toddrme2178@gmail.com
|
||||
|
||||
- Implement single-spec
|
||||
- Update to 0.2.0
|
||||
* treat strings under ironpthon 2.7 as unicode, like 3.x
|
||||
* Omit missing directories from MANIFEST
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 21 11:19:50 UTC 2015 - toddrme2178@gmail.com
|
||||
|
||||
- Add python 2.7 requirement
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 21 11:25:05 UTC 2015 - toddrme2178@gmail.com
|
||||
|
||||
- Initial version
|
||||
|
67
python-ipython_genutils.spec
Normal file
67
python-ipython_genutils.spec
Normal file
@ -0,0 +1,67 @@
|
||||
#
|
||||
# spec file for package python-ipython_genutils
|
||||
#
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
Name: python-ipython_genutils
|
||||
Version: 0.2.0
|
||||
Release: 0
|
||||
Summary: Vestigial utilities from IPython
|
||||
License: BSD-3-Clause
|
||||
Group: Development/Languages/Python
|
||||
URL: https://ipython.org
|
||||
Source: https://files.pythonhosted.org/packages/source/i/ipython_genutils/ipython_genutils-%{version}.tar.gz
|
||||
# PATCH-FEATURE-UPSTREAM denose.patch gh#ipython/ipython_genutils#17 mcepl@suse.com
|
||||
# Replace dependency on nose with the one on pytest
|
||||
Patch0: denose.patch
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
This 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 package will go away.
|
||||
|
||||
No projects should depend on this package directly. It will be pulled in by
|
||||
whatever packages need it
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n ipython_genutils-%{version}
|
||||
|
||||
%build
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%pyproject_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
export LC_ALL=en_US.utf8
|
||||
%pytest
|
||||
|
||||
%files %{python_files}
|
||||
%license COPYING.md
|
||||
%doc CONTRIBUTING.md README.md
|
||||
%{python_sitelib}/ipython_genutils
|
||||
%{python_sitelib}/ipython_genutils-%{version}.dist-info
|
||||
|
||||
%changelog
|
Loading…
Reference in New Issue
Block a user