Coder Social home page Coder Social logo

traceback2's People

Contributors

berkerpeksag avatar javacruft avatar jelmer avatar kelledin avatar kloczek avatar rbtcollins avatar zaneb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

traceback2's Issues

Add MANIFEST w/ LICENSE reference

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?

support pytest

Just normal build, install and test cycle used on building package from non-root account:

  • "setup.py build"
  • "setup.py install --root </install/prefix>"
  • "pytest with PYTHONPATH pointing to setearch and sitelib inside </install/prefix>
+ 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 ==================================================================

Make libraries available in python3 optional

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.

RFE: please provide update for latest `testtools` 2.7.0

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 ================================================================================

traceback2 does not conform to PEP 396 (missing __version__ string)

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:

  • On a case-by-case basis, standard library modules which are also released in standalone form for other Python versions MAY include a module version number when included in the standard library, and SHOULD include a version number when packaged separately.
  • When a module (or package) includes a version number, the version SHOULD be available in the __version__ attribute.
  • The __version__ attribute's value SHOULD be a string.

Don't use "linecache2" for recent Python 3 versions

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.

pip fails to install under Python 3.2

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.

No license file

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.

unknown license

License: UNKNOWN

could you please specify a license?
otherwise it is not possible to create a package for it...

Test errors

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.