Git Product home page Git Product logo

python-yagot's People

Contributors

andy-maier avatar

Watchers

 avatar  avatar

python-yagot's Issues

Add pytest plugin

Actual behavior

Currently, each test function needs to be decorated individually.

Expected behavior

A pytest plugin should be added to enable the tracking by command line option of pytest.

Execution environment

  • yagot version:
  • Python version:
  • Operating System (type+version):

0.5.0: broken pypi source tar ball (missing requirements.txt)

+ cd yagot-0.5.0
+ /usr/bin/python3 setup.py build '--executable=/usr/bin/python3 -s'
Traceback (most recent call last):
  File "setup.py", line 54, in <module>
    requirements = get_requirements('requirements.txt')
  File "setup.py", line 34, in get_requirements
    with open(requirements_file, 'r') as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
error: Bad exit status from /var/tmp/rpm-tmp.JOmoYy (%build)

0.5.0: pytest is failing

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-yagot-0.5.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-yagot-0.5.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/python3 -Bm pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/tkloczko/rpmbuild/BUILD/python-yagot-0.5.0
plugins: yagot-0.5.0, forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, cov-2.11.1, httpbin-1.0.0, xdist-2.2.1, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, pyfakefs-4.4.0, freezegun-0.4.2, cases-3.4.6, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, flaky-3.7.0, requests-mock-1.9.2, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, hypothesis-6.13.6
collected 104 items

. .                                                                                                                                                                  [  0%]
examples/test_1.py .                                                                                                                                                 [  1%]
examples/test_2.py F                                                                                                                                                 [  2%]
tests/plugintest/test_plugin.py .......x                                                                                                                             [ 10%]
tests/unittest/test_decorator.py .x..                                                                                                                                [ 14%]
tests/unittest/test_garbagetracker.py .........................................................................................                                      [100%]

================================================================================= FAILURES =================================================================================
____________________________________________________________________________ test_selfref_dict _____________________________________________________________________________

args = (), kwargs = {}, tracker = <yagot._garbagetracker.GarbageTracker object at 0x7fbe813cd1c0>, ret = None, location = 'test_2::test_selfref_dict'
@py_assert1 = [{'self': {'self': {'self': {'self': {'self': {...}}}}}}], @py_assert3 = False
@py_format4 = "\n~There were 1 collected or uncollectable object(s) caused by function test_2::test_selfref_dict:\n~\n~1: <class 'di...': {'self': {'self': {'self': {...}}}}}}] = <yagot._garbagetracker.GarbageTracker object at 0x7fbe813cd1c0>.garbage\n}"

    @functools.wraps(func)
    def wrapper_garbage_checked(*args, **kwargs):
        "Wrapper function for the garbage_checked decorator"
        tracker = GarbageTracker.get_tracker()
        tracker.enable(leaks_only=leaks_only)
        tracker.start()
        tracker.ignore_types(type_list=ignore_types)
        ret = func(*args, **kwargs)  # The decorated function
        tracker.stop()
        location = "{module}::{function}".format(
            module=func.__module__, function=func.__name__)
>       assert not tracker.garbage, tracker.assert_message(location)
E       AssertionError:
E         There were 1 collected or uncollectable object(s) caused by function test_2::test_selfref_dict:
E
E         1: <class 'dict'> object at 0x7fbe8149d980:
E         {'self': <Recursive reference to dict object at 0x7fbe8149d980>}
E
E       assert not [{'self': {'self': {'self': {'self': {'self': {...}}}}}}]
E        +  where [{'self': {'self': {'self': {'self': {'self': {...}}}}}}] = <yagot._garbagetracker.GarbageTracker object at 0x7fbe813cd1c0>.garbage

yagot/_decorators.py:67: AssertionError
========================================================================= short test summary info ==========================================================================
XFAIL tests/plugintest/test_plugin.py::test_uncollectable_incref
  Increased reference count is not detected
XFAIL tests/unittest/test_decorator.py::test_leaks_selfref_1
FAILED examples/test_2.py::test_selfref_dict - AssertionError:
================================================================ 1 failed, 101 passed, 2 xfailed in 14.98s =================================================================

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.