Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3.10 test failures #173

Open
jsmolic opened this issue May 8, 2021 · 1 comment
Open

python3.10 test failures #173

jsmolic opened this issue May 8, 2021 · 1 comment

Comments

@jsmolic
Copy link

jsmolic commented May 8, 2021

When running tests with Python 3.10.0b1, I get the following errors:

======================================================================
ERROR: this(None).should.be.none
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/tests/test_assertion_builder.py", line 140, in test_should_be_a
    assert this([]).should.be.a('collections.Iterable')
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 385, in wrapper
    value = func(self, *args, **kw)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 721, in an
    klass = reduce(getattr, items, __import__(first))
AttributeError: module 'collections' has no attribute 'Iterable'

======================================================================
FAIL: issues.test_issue_104.test_issue_104
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 385, in wrapper
    value = func(self, *args, **kw)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 636, in within
    raise AssertionError((
AssertionError: world.should.be.within(hello world, ) must be called with either a iterable:
world.should.be.within([1, 2, 3, 4])
or with a range of numbers:world.should.be.within(1, 3000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 385, in wrapper
    value = func(self, *args, **kw)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 888, in contain
    return expect(what).to.be.within(obj)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 387, in wrapper
    raise AssertionError(e)
AssertionError: world.should.be.within(hello world, ) must be called with either a iterable:
world.should.be.within([1, 2, 3, 4])
or with a range of numbers:world.should.be.within(1, 3000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/tests/issues/test_issue_104.py", line 12, in test_issue_104
    expect("hello world").to.contain("world")
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 387, in wrapper
    raise AssertionError(e)
AssertionError: world.should.be.within(hello world, ) must be called with either a iterable:
world.should.be.within([1, 2, 3, 4])
or with a range of numbers:world.should.be.within(1, 3000)

======================================================================
FAIL: expect('some string').to.contain('tri')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 385, in wrapper
    value = func(self, *args, **kw)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 636, in within
    raise AssertionError((
AssertionError: tri.should.be.within(some string, ) must be called with either a iterable:
tri.should.be.within([1, 2, 3, 4])
or with a range of numbers:tri.should.be.within(1, 3000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 385, in wrapper
    value = func(self, *args, **kw)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 888, in contain
    return expect(what).to.be.within(obj)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 387, in wrapper
    raise AssertionError(e)
AssertionError: tri.should.be.within(some string, ) must be called with either a iterable:
tri.should.be.within([1, 2, 3, 4])
or with a range of numbers:tri.should.be.within(1, 3000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/tests/test_assertion_builder.py", line 570, in test_match_contain
    assert this("some string").should.contain("tri")
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 387, in wrapper
    raise AssertionError(e)
AssertionError: tri.should.be.within(some string, ) must be called with either a iterable:
tri.should.be.within([1, 2, 3, 4])
or with a range of numbers:tri.should.be.within(1, 3000)

======================================================================
FAIL: do not patch already existing class attributes with same name
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 385, in wrapper
    value = func(self, *args, **kw)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 636, in within
    raise AssertionError((
AssertionError: when.should.be.within({'__module__': 'test_cpython_patches', 'when': 42, 'shouldnt': 43, 'bar': 'bar', '__dict__': <attribute '__dict__' of 'Foo' objects>, '__weakref__': <attribute '__weakref__' of 'Foo' objects>, '__doc__': None}, ) must be called with either a iterable:
when.should.be.within([1, 2, 3, 4])
or with a range of numbers:when.should.be.within(1, 3000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 385, in wrapper
    value = func(self, *args, **kw)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 888, in contain
    return expect(what).to.be.within(obj)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 387, in wrapper
    raise AssertionError(e)
AssertionError: when.should.be.within({'__module__': 'test_cpython_patches', 'when': 42, 'shouldnt': 43, 'bar': 'bar', '__dict__': <attribute '__dict__' of 'Foo' objects>, '__weakref__': <attribute '__weakref__' of 'Foo' objects>, '__doc__': None}, ) must be called with either a iterable:
when.should.be.within([1, 2, 3, 4])
or with a range of numbers:when.should.be.within(1, 3000)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/tests/test_cpython_patches.py", line 45, in test_shouldnt_overwrite_class_attributes
    Foo.__dict__.should.contain('when')
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 387, in wrapper
    raise AssertionError(e)
AssertionError: when.should.be.within({'__module__': 'test_cpython_patches', 'when': 42, 'shouldnt': 43, 'bar': 'bar', '__dict__': <attribute '__dict__' of 'Foo' objects>, '__weakref__': <attribute '__weakref__' of 'Foo' objects>, '__doc__': None}, ) must be called with either a iterable:
when.should.be.within([1, 2, 3, 4])
or with a range of numbers:when.should.be.within(1, 3000)

======================================================================
FAIL: sure.that_with_context() when no context is given it fails
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/old.py", line 129, in raises
    self._src(*self._callable_args, **self._callable_kw)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 152, in wrap
    res = test.apply(context)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/__init__.py", line 117, in apply
    return self.callback(*args, **self.kwargs)
TypeError: test_context_is_not_optional.<locals>.it_crashes() takes 0 positional arguments but 1 was given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/tests/test_old_api.py", line 59, in test_context_is_not_optional
    assert that(it_crashes).raises(
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/old.py", line 148, in raises
    raise AssertionError('''
AssertionError: <function test_context_is_not_optional.<locals>.it_crashes at 0x7fec6b094160> raised TypeError, but the exception message does not
                    match.

EXPECTED:
the function it_crashes defined at test_old_api.py line 56, is being decorated by either @that_with_context or @scenario, so it should take at least 1 parameter, which is the test context

GOT:
test_context_is_not_optional.<locals>.it_crashes() takes 0 positional arguments but 1 was given

======================================================================
FAIL: that() has(object)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/tests/test_old_api.py", line 153, in test_that_has
    assert that(name).has("john")
  File "/var/tmp/portage/dev-python/sure-1.4.11/work/sure-1.4.11/sure/old.py", line 75, in wrap
    assert ret, msg % (self._src, what)
AssertionError: 'john' should have 'john', but have not
@yan12125
Copy link

yan12125 commented Dec 7, 2021

FWIW, I got only one failure for python-sure 2.0 on python 3.10.0, and it can be fixed by this patch: #169 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants