guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Python


From: Andreas Enge
Subject: Re: Python
Date: Sat, 25 Feb 2023 17:39:55 +0100

Am Sat, Feb 25, 2023 at 04:45:39PM +0100 schrieb Lars-Dominik Braun:
> note that importlib-metadata is – again – part of the standard
> library, as the table on [1] points out. So if we would ship Python 3.12,
> we would not need it. Bumping it to version 5.2 seems like the correct
> approach right now, since we’re at 3.10.7 on core-updates (as far as I see).

Very interesting! I am just not used to these very dynamically changing
languages. After a bit of discussion, we recently decided with my coauthor
to assume the C99 standard in our library instead of C89 :)

Right now I am left with a number of test failures that look real and cannot
easily be solved by an upgrade (either because we are already on the latest
version or because the tests still fail): python-sgmllib3k, python-typeguard
and python-coveralls. See messages below.

Andreas


python-coveralls:
=================================== FAILURES ===================================
___________________ ReporterTest.test_reporter_with_branches ___________________

self = <tests.api.reporter_test.ReporterTest 
testMethod=test_reporter_with_branches>

    def test_reporter_with_branches(self):
        subprocess.call(['coverage', 'run', '--branch', '--omit=**/.tox/*',
                         'runtests.py'], cwd=EXAMPLE_DIR)
        results = Coveralls(repo_token='xxx').get_coverage()
        assert len(results) == 2

        # Branches are expressed as four values each in a flat list
        assert not len(results[0]['branches']) % 4
        assert not len(results[1]['branches']) % 4

>       assert_coverage(results[0], {
            'source': ('def hello():\n'
                       '    print(\'world\')\n\n\n'
                       'class Foo:\n'
                       '    """ Bar """\n\n\n'
                       'def baz():\n'
                       '    print(\'this is not tested\')\n\n'
                       'def branch(cond1, cond2):\n'
                       '    if cond1:\n'
                       '        print(\'condition tested both ways\')\n'
                       '    if cond2:\n'
                       '        print(\'condition not tested both ways\')\n'),
            'name': 'project.py',
            'branches': [13, 0, 14, 1, 13, 0, 15, 1, 15, 0, 16, 1, 15, 0, 12,
                         0],
            'coverage': [1, 1, None, None, 1, None, None,
                         None, 1, 0, None, 1, 1, 1, 1, 1]})

/tmp/guix-build-python-coveralls-3.2.0.drv-0/source/tests/api/reporter_test.py:182:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

actual = {'branches': [5, 0, 6, 1, 5, 0, ...], 'coverage': [1, 1, None, None, 
1, None, ...], 'name': 'project.py', 'source': 'd...1:\n        
print(\'condition tested both ways\')\n    if cond2:\n        print(\'condition 
not tested both ways\')\n'}
expected = {'branches': [13, 0, 14, 1, 13, 0, ...], 'coverage': [1, 1, None, 
None, 1, None, ...], 'name': 'project.py', 'source':...1:\n        
print(\'condition tested both ways\')\n    if cond2:\n        print(\'condition 
not tested both ways\')\n'}

    def assert_coverage(actual, expected):
        assert actual['source'].strip() == expected['source'].strip()
        assert actual['name'] == expected['name']
        assert actual['coverage'] == expected['coverage']
>       assert actual.get('branches') == expected.get('branches')
E       assert [5, 0, 6, 1, 5, 0, 9, 1, 13, 0, 14, 1, 13, 0, 15, 1, 15, 0, 16, 
1, 15, 0, 12, 0] == [13, 0, 14, 1, 13, 0, 15, 1, 15, 0, 16, 1, 15, 0, 12, 0]
E         At index 0 diff: 5 != 13
E         Left contains 8 more items, first extra item: 15
E         Full diff:
E         - [13, 0, 14, 1, 13, 0, 15, 1, 15, 0, 16, 1, 15, 0, 12, 0]
E         + [5, 0, 6, 1, 5, 0, 9, 1, 13, 0, 14, 1, 13, 0, 15, 1, 15, 0, 16, 1, 
15, 0, 12, 0]
E         ?  ++++++++++++++++++++++++

/tmp/guix-build-python-coveralls-3.2.0.drv-0/source/tests/api/reporter_test.py:17:
 AssertionError
----------------------------- Captured stdout call -----------------------------
world
condition not tested both ways
condition tested both ways
condition not tested both ways
=========================== short test summary info ============================
FAILED tests/api/reporter_test.py::ReporterTest::test_reporter_with_branches
=================== 1 failed, 51 passed, 1 skipped in 2.51s ====================
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "pytest" arguments: ("-vv") exit-status: 1 
term-signal: #f stop-signal: #f>
phase `check' failed after 2.8 seconds
command "pytest" "-vv" failed with status 1
builder for 
`/gnu/store/2f7hab84ljj1k284w61zn14cbapzfdnf-python-coveralls-3.2.0.drv' failed 
with exit code 1
build of /gnu/store/2f7hab84ljj1k284w61zn14cbapzfdnf-python-coveralls-3.2.0.drv 
failed
View build log at 
'/var/log/guix/drvs/2f/7hab84ljj1k284w61zn14cbapzfdnf-python-coveralls-3.2.0.drv.gz'.


python-sgmllib3k:
======================================================================
FAIL: test_declaration_junk_chars (test_sgmllib.SGMLParserTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/tmp/guix-build-python-sgmllib3k-1.0.0-1.7999646.drv-0/source/test_sgmllib.py",
 line 310, in test_declaration_junk_chars
    self.check_parse_error("<!DOCTYPE foo $ >")
  File 
"/tmp/guix-build-python-sgmllib3k-1.0.0-1.7999646.drv-0/source/test_sgmllib.py",
 line 127, in check_parse_error
    parser.feed(source)
  File 
"/tmp/guix-build-python-sgmllib3k-1.0.0-1.7999646.drv-0/source/sgmllib.py", 
line 98, in feed
    self.goahead(0)
  File 
"/tmp/guix-build-python-sgmllib3k-1.0.0-1.7999646.drv-0/source/sgmllib.py", 
line 168, in goahead
    k = self.parse_declaration(i)
  File 
"/gnu/store/blals34ar25fiifvm17m2b504waxzys0-python-3.10.7/lib/python3.10/_markupbase.py",
 line 134, in parse_declaration
    raise AssertionError("unexpected %r char in declaration" % rawdata[j])
AssertionError: unexpected '$' char in declaration

----------------------------------------------------------------------
Ran 23 tests in 0.008s

FAILED (failures=1)
Test failed: <unittest.runner.TextTestResult run=23 errors=0 failures=1>
error: Test failed: <unittest.runner.TextTestResult run=23 errors=0 failures=1>
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "python" arguments: ("-c" "import 
setuptools, tokenize;__file__='setup.py';f=getattr(tokenize, 'open', 
open)(__file__);code=f.read().replace('\\r\\n', 
'\\n');f.close();exec(compile(code, __file__, 'exec'))" "test") exit-status: 1 
term-signal: #f stop-signal: #f> 
phase `check' failed after 0.3 seconds
command "python" "-c" "import setuptools, 
tokenize;__file__='setup.py';f=getattr(tokenize, 'open', 
open)(__file__);code=f.read().replace('\\r\\n', 
'\\n');f.close();exec(compile(code, __file__, 'exec'))" "test" failed with 
status 1
builder for 
`/gnu/store/cp8sgcp3c1599dzjwmfms38jz3iddyk1-python-sgmllib3k-1.0.0-1.7999646.drv'
 failed with exit code 1
build of 
/gnu/store/cp8sgcp3c1599dzjwmfms38jz3iddyk1-python-sgmllib3k-1.0.0-1.7999646.drv
 failed
View build log at 
'/var/log/guix/drvs/cp/8sgcp3c1599dzjwmfms38jz3iddyk1-python-sgmllib3k-1.0.0-1.7999646.drv.gz'.


python-typeguard:
=================================== FAILURES ===================================
___________________ TestTypeChecked.test_typed_dict[correct] ___________________
tests/test_typeguard.py:1343: in test_typed_dict
    foo(value)
/gnu/store/qmli9ql0wplg1hyacy07kvgaqbpfa11z-python-typeguard-2.13.3/lib/python3.10/site-packages/typeguard/__init__.py:1032:
 in wrapper
    check_argument_types(memo)
/gnu/store/qmli9ql0wplg1hyacy07kvgaqbpfa11z-python-typeguard-2.13.3/lib/python3.10/site-packages/typeguard/__init__.py:875:
 in check_argument_types
    raise TypeError(*exc.args) from None
E   TypeError: TypedDict does not support instance and class checks
__________________ TestTypeChecked.test_typed_dict[missing_x] __________________
tests/test_typeguard.py:1341: in test_typed_dict
    pytest.raises(TypeError, foo, value).match(error_re)
E   AssertionError: Regex pattern 'required key\\(s\\) \\("x"\\) missing from 
argument "arg"' does not match 'TypedDict does not support instance and class 
checks'.
___________________ TestTypeChecked.test_typed_dict[wrong_y] ___________________
tests/test_typeguard.py:1341: in test_typed_dict
    pytest.raises(TypeError, foo, value).match(error_re)
E   AssertionError: Regex pattern 'type of dict item "y" for argument "arg" 
must be str; got int instead' does not match 'TypedDict does not support 
instance and class checks'.
_______________ TestTypeChecked.test_typed_dict[missing_y_error] _______________
tests/test_typeguard.py:1341: in test_typed_dict
    pytest.raises(TypeError, foo, value).match(error_re)
E   AssertionError: Regex pattern 'required key\\(s\\) \\("y"\\) missing from 
argument "arg"' does not match 'TypedDict does not support instance and class 
checks'.
________________ TestTypeChecked.test_typed_dict[missing_y_ok] _________________
tests/test_typeguard.py:1343: in test_typed_dict
    foo(value)
/gnu/store/qmli9ql0wplg1hyacy07kvgaqbpfa11z-python-typeguard-2.13.3/lib/python3.10/site-packages/typeguard/__init__.py:1032:
 in wrapper
    check_argument_types(memo)
/gnu/store/qmli9ql0wplg1hyacy07kvgaqbpfa11z-python-typeguard-2.13.3/lib/python3.10/site-packages/typeguard/__init__.py:875:
 in check_argument_types
    raise TypeError(*exc.args) from None
E   TypeError: TypedDict does not support instance and class checks
___________________ TestTypeChecked.test_typed_dict[wrong_x] ___________________
tests/test_typeguard.py:1341: in test_typed_dict
    pytest.raises(TypeError, foo, value).match(error_re)
E   AssertionError: Regex pattern 'type of dict item "x" for argument "arg" 
must be int; got str instead' does not match 'TypedDict does not support 
instance and class checks'.
_________________ TestTypeChecked.test_typed_dict[unknown_key] _________________
tests/test_typeguard.py:1341: in test_typed_dict
    pytest.raises(TypeError, foo, value).match(error_re)
E   AssertionError: Regex pattern 'extra key\\(s\\) \\("foo"\\) in argument 
"arg"' does not match 'TypedDict does not support instance and class checks'.
=============================== warnings summary ===============================
tests/test_typeguard.py::TestTypeChecker::test_generator
tests/test_typeguard.py::TestTypeChecker::test_exception
tests/test_typeguard_py36.py::TestTypeChecker::test_async_generator[generator]
tests/test_typeguard_py36.py::TestTypeChecker::test_async_generator[iterable]
tests/test_typeguard_py36.py::TestTypeChecker::test_async_generator[iterator]
  
/gnu/store/fgbf94ab19n90rsz6h7vrvqyw17w9kqa-python-pytest-7.1.3/lib/python3.10/site-packages/_pytest/python.py:192:
 PytestRemovedIn8Warning: Passing None has been deprecated.
  See 
https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests
 for alternatives in common use cases.
    result = testfunction(**testargs)

tests/test_typeguard_py36.py::TestTypeChecker::test_callable
  
/gnu/store/qmli9ql0wplg1hyacy07kvgaqbpfa11z-python-typeguard-2.13.3/lib/python3.10/site-packages/typeguard/__init__.py:1027:
 UserWarning: no code associated -- not typechecking 
test_typeguard_py36.<test_typeguard_py36.TestTypeChecker.test_callable.<locals>.command
 object at 0x7ffff5d4a800>
    warn('no code associated -- not typechecking 
{}'.format(function_name(func)))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========== 7 failed, 233 passed, 3 deselected, 6 warnings in 2.13s ============
error: in phase 'check': uncaught exception:
%exception #<&invoke-error program: "pytest" arguments: ("-vv" "-k" "not 
usefixtures and not test_cached_module") exit-status: 1 term-signal: #f 
stop-signal: #f> 
phase `check' failed after 2.5 seconds
command "pytest" "-vv" "-k" "not usefixtures and not test_cached_module" failed 
with status 1
builder for 
`/gnu/store/l9gb4nadq9c43zn82wqbxmwgib7bkqqs-python-typeguard-2.13.3.drv' 
failed with exit code 1
build of 
/gnu/store/l9gb4nadq9c43zn82wqbxmwgib7bkqqs-python-typeguard-2.13.3.drv failed
View build log at 
'/var/log/guix/drvs/l9/gb4nadq9c43zn82wqbxmwgib7bkqqs-python-typeguard-2.13.3.drv.gz'.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]