testing-cabal / traceback2 Goto Github PK
View Code? Open in Web Editor NEWBackport of the Python stdlib traceback module
License: Other
Backport of the Python stdlib traceback module
License: Other
Hey-lo,
We're finishing up the conda
build of traceback2 for conda-forge and would like to throw in a link to the LICENSE file. This can't be done with an explicit MANIFEST identifying the license as part of the source distribution. Would y'all consider adding a MANIFEST to future releases?
Just normal build, install and test cycle used on building package from non-root account:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-traceback2-1.4.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-traceback2-1.4.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ PYTHONDONTWRITEBYTECODE=1
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/traceback2-1.4.0
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, cases-3.6.1, flaky-3.7.0, hypothesis-6.14.0, benchmark-3.4.1, xdist-2.3.0, Faker-8.8.1
collected 49 items
. . [ 2%]
traceback2/tests/test_traceback.py ...............F...........F.........ss........ [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 478, 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 File "/home/tkloczko/rpmbuild/BUILD/traceback2-1.4.0/traceback2/tests/test_traceback.py", line 651, in some_inner
E traceback.walk_stack(None), capture_locals=True, limit=1)
E a = 1
E b = 2
E k = 3
E v = 4
E
E File "/home/tkloczko/rpmbuild/BUILD/traceback2-1.4.0/traceback2/tests/test_traceback.py", line 650, in some_inner
E return traceback.StackSummary.extract(
E a = 1
E b = 2
E k = 3
E v = 4
E
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
========================================================================= short test summary info ==========================================================================
SKIPPED [1] traceback2/tests/test_traceback.py:869: Applies to 2.x only.
SKIPPED [1] traceback2/tests/test_traceback.py:837: 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, 44 passed, 2 skipped in 8.50s ==================================================================
traceback2/traceback2/__init__.py
Line 7 in 37c5f15
The six module is not specified in the requirements.txt file.
While trying to trim requirements on our packages as lean as possible I have developed this patch. I think really dependency on such libraries as unittest2
(unnecessary for any upstream supported version of Python) should be strictly optional, so that this library my finally get its deserved rest.
Looks like test suite needs to be updated
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-traceback2-1.4.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-traceback2-1.4.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.18, pytest-7.4.3, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/traceback2-1.4.0
plugins: mypy-0.10.3, black-0.3.12, flake8-1.1.1, checkdocs-2.10.1, enabler-2.3.1, cov-4.1.0, hypothesis-6.84.3
collected 11 items / 1 error
========================================================================================== ERRORS ===========================================================================================
____________________________________________________________________ ERROR collecting traceback2/tests/test_traceback.py ____________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/traceback2-1.4.0/traceback2/tests/test_traceback.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
traceback2/tests/test_traceback.py:29: in <module>
import testtools
/usr/lib/python3.8/site-packages/testtools/__init__.py:50: in <module>
from testtools.matchers._impl import Matcher
E ModuleNotFoundError: No module named 'testtools.matchers'
===================================================================================== warnings summary ======================================================================================
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:147
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:147
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:147
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:147
/usr/lib/python3.8/site-packages/_pytest/nodes.py:147: PytestDeprecationWarning: <class 'pytest_black.BlackItem'> is not using a cooperative constructor and only takes {'parent', 'fspath'}.
See https://docs.pytest.org/en/stable/deprecations.html#constructors-of-custom-pytest-node-subclasses-should-take-kwargs for more details.
warnings.warn(
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:264
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:264
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:264
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:264
/usr/lib/python3.8/site-packages/_pytest/nodes.py:264: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to BlackItem is deprecated. Please use the (path: pathlib.Path) argument instead.
See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
return cls._create(parent=parent, **kw)
../../../../../usr/lib/python3.8/site-packages/_pytest/nodes.py:724
/usr/lib/python3.8/site-packages/_pytest/nodes.py:724: PytestWarning: BlackItem is an Item subclass and should not be a collector, however its bases File are collectors.
Please split the Collectors and the Item into separate node types.
Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html
example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
---------- coverage: platform linux, python 3.8.18-final-0 -----------
Name Stmts Miss Cover
--------------------------------------------------------
traceback2/__init__.py 245 193 21%
traceback2/tests/__init__.py 0 0 100%
traceback2/tests/test_traceback.py 629 613 3%
--------------------------------------------------------
TOTAL 874 806 8%
================================================================================== short test summary info ==================================================================================
ERROR traceback2/tests/test_traceback.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=============================================================================== 9 warnings, 1 error in 0.24s ================================================================================
Please see testing-cabal/testtools#162 and https://code.djangoproject.com/ticket/25761 for more details about how this assumption is broken by Django and possibly other Python 2 code out there.
And this in turn breaks valid usage of traceback2 ...
For our package management we use automated tooling to extract version numbers from python packages. I would like to request that you add the __version__
attribute version string.
PEP 396 states:
__version__
attribute.__version__
attribute's value SHOULD be a string.traceback2 requires linecache2, but linecache2 is a backport (unfortunately it does not tell from which Python version, see testing-cabal/linecache2#13). Please update the requirements file to conditionally require linecache2 only for older Python version.
Each additional package makes distribution maintainers life more complicated, since they have to maintain yet another package even if the distribution only includes Python 3.5 or even 3.6
Thanks.
From https://travis-ci.org/testing-cabal/traceback2/jobs/298642765:
$ pip install -U pip wheel setuptools
$ pip install -r requirements.txt
Traceback (most recent call last):
File "/home/travis/virtualenv/python3.2.6/bin/pip", line 7, in <module>
from pip import main
File "/home/travis/virtualenv/python3.2.6/lib/python3.2/site-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/home/travis/virtualenv/python3.2.6/lib/python3.2/site-packages/pip/_vendor/requests/__init__.py", line 66, in <module>
from .models import Request, Response, PreparedRequest
File "/home/travis/virtualenv/python3.2.6/lib/python3.2/site-packages/pip/_vendor/requests/models.py", line 856
http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
^
SyntaxError: invalid syntax
We should probably stop invoking pip install -U pip wheel setuptools
under Python 3.2.
This project claims that it's under the Python Software Foundation License per its metadata, but doesn't include the actual license file / notice anywhere.
License: UNKNOWN
could you please specify a license?
otherwise it is not possible to create a package for it...
I use linecache2-1.0.0, unittest2 1.0.1.
Output of test suite for traceback2 trunk:
$ python2.7 -m unittest2 discover
.EEEEE.....E....................ss..s..........
======================================================================
ERROR: test_cause (traceback2.tests.test_traceback.PyExcReportingTests)
traceback2.tests.test_traceback.PyExcReportingTests.test_cause
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Traceback (most recent call last):
SkipTest: Only applies to 3.2+
======================================================================
ERROR: test_cause_and_context (traceback2.tests.test_traceback.PyExcReportingTests)
traceback2.tests.test_traceback.PyExcReportingTests.test_cause_and_context
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Traceback (most recent call last):
SkipTest: Only applies to 3.2+
======================================================================
ERROR: test_cause_recursive (traceback2.tests.test_traceback.PyExcReportingTests)
traceback2.tests.test_traceback.PyExcReportingTests.test_cause_recursive
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Traceback (most recent call last):
SkipTest: Only applies to 3.2+
======================================================================
ERROR: test_context (traceback2.tests.test_traceback.PyExcReportingTests)
traceback2.tests.test_traceback.PyExcReportingTests.test_context
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Traceback (most recent call last):
SkipTest: Only applies to 3.2+
======================================================================
ERROR: test_context_suppression (traceback2.tests.test_traceback.PyExcReportingTests)
traceback2.tests.test_traceback.PyExcReportingTests.test_context_suppression
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Traceback (most recent call last):
SkipTest: Only applies to 3.3+
======================================================================
ERROR: test_encoded_file (traceback2.tests.test_traceback.SyntaxTracebackCases)
traceback2.tests.test_traceback.SyntaxTracebackCases.test_encoded_file
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Traceback (most recent call last):
File "traceback2/tests/test_traceback.py", line 225, in test_encoded_file
do_test("", "foo", "ascii", 3, output_encoding)
File "traceback2/tests/test_traceback.py", line 217, in do_test
stdout[1], lineno))
TypeError: assertIn() takes exactly 3 arguments (4 given)
----------------------------------------------------------------------
Ran 47 tests in 0.119s
FAILED (errors=6, skipped=3)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.