-
Notifications
You must be signed in to change notification settings - Fork 10
support pytest #16
Comments
Here is tests of the 1.4.0 + all master patches + below patch --- a/traceback2/tests/test_traceback.py~ 2015-03-09 06:56:36.000000000 +0000
+++ b/traceback2/tests/test_traceback.py 2021-12-26 07:05:23.292113915 +0000
@@ -25,7 +25,7 @@
else:
def raise_from(value, from_value):
raise value
-import unittest2 as unittest
+import unittest
import testtools
from testtools.matchers import DocTestMatches, Equals, MatchesAny
which switches fto standard Here it is pytest output: + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-traceback2-1.4.0-3.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-traceback2-1.4.0-3.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
Using --randomly-seed=1551105734
rootdir: /home/tkloczko/rpmbuild/BUILD/traceback2-1.4.0
plugins: freezegun-0.4.2, mock-3.6.1, randomly-3.10.3, timeout-2.0.2, flaky-3.7.0, cov-3.0.0
collected 49 items
traceback2/tests/test_traceback.py ...........F.............s......s.........F...... [100%]
================================================================================= FAILURES =================================================================================
_______________________________________________________________ PyExcReportingTests.test_context_suppression _______________________________________________________________
'NoneType' object is not iterable
During handling of the above exception, another exception occurred:
NOTE: Incompatible Exception Representation, displaying natively:
testtools.testresult.real._StringException: Traceback (most recent call last):
File "/home/tkloczko/rpmbuild/BUILD/traceback2-1.4.0/traceback2/tests/test_traceback.py", line 419, in test_context_suppression
self.assertThat(lines, DocTestMatches("""\
File "/usr/lib/python3.8/site-packages/testtools/testcase.py", line 480, in assertThat
raise mismatch_error
testtools.matchers._impl.MismatchError: Expected:
Traceback (most recent call last):
File "...traceback2/tests/test_traceback.py", line ..., in test_context_suppression
raise_from(ZeroDivisionError, None)
File "<string>", line 2, in raise_from
ZeroDivisionError
Got:
Traceback (most recent call last):
File "/home/tkloczko/rpmbuild/BUILD/traceback2-1.4.0/traceback2/tests/test_traceback.py", line 414, in test_context_suppression
raise_from(ZeroDivisionError, None)
File "<string>", line 3, in raise_from
ZeroDivisionError
_______________________________________________________________________ TestStack.test_format_locals _______________________________________________________________________
self = <traceback2.tests.test_traceback.TestStack testMethod=test_format_locals>
def test_format_locals(self):
def some_inner(k, v):
a = 1
b = 2
return traceback.StackSummary.extract(
traceback.walk_stack(None), capture_locals=True, limit=1)
s = some_inner(3, 4)
> self.assertEqual(
[' File "' + FNAME + '", line 651, '
'in some_inner\n'
' traceback.walk_stack(None), capture_locals=True, limit=1)\n'
' a = 1\n'
' b = 2\n'
' k = 3\n'
' v = 4\n'
], s.format())
E AssertionError: Lists differ: [' F[91 chars]ne 651, in some_inner\n traceback.walk_stac[81 chars]4\n'] != [' F[91 chars]ne 650, in some_inner\n return traceback.St[62 chars]4\n']
E
E First differing element 0:
E ' Fi[90 chars]ne 651, in some_inner\n traceback.walk_stac[80 chars] 4\n'
E ' Fi[90 chars]ne 650, in some_inner\n return traceback.St[61 chars] 4\n'
E
E [' File '
E '"/home/tkloczko/rpmbuild/BUILD/traceback2-1.4.0/traceback2/tests/test_traceback.py", '
E - 'line 651, in some_inner\n'
E ? ^
E
E + 'line 650, in some_inner\n'
E ? ^
E
E - ' traceback.walk_stack(None), capture_locals=True, limit=1)\n'
E + ' return traceback.StackSummary.extract(\n'
E ' a = 1\n'
E ' b = 2\n'
E ' k = 3\n'
E ' v = 4\n']
traceback2/tests/test_traceback.py:653: AssertionError
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/pytest_freezegun.py:17: 98 warnings
/usr/lib/python3.8/site-packages/pytest_freezegun.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(pytest.__version__) < LooseVersion('3.6.0'):
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] traceback2/tests/test_traceback.py:899: Applies to 2.x only.
SKIPPED [1] traceback2/tests/test_traceback.py:867: Applies to 2.x only.
FAILED traceback2/tests/test_traceback.py::PyExcReportingTests::test_context_suppression
FAILED traceback2/tests/test_traceback.py::TestStack::test_format_locals - AssertionError: Lists differ: [' F[91 chars]ne 651, in some_inner\n traceback.walk_stac[81...
=========================================================== 2 failed, 45 passed, 2 skipped, 98 warnings in 0.99s =========================================================== |
Gentle ping .. any update? 🤔 |
Same as for the other projects; we don't use pytest, so if you'd like to see this project support pytest, you're going to have to create a PR to make it work with that. |
So would you accept unittest2->unittest migration? Other reported issue are pointing on tested code issue so it is hard to solve that without proper |
Yeah, I think we can migrate to unittest at this point since we've dropped python<2.7 support |
OK will make PR. |
Just normal build, install and test cycle used on building package from non-root account:
The text was updated successfully, but these errors were encountered: