Skip to content
This repository was archived by the owner on Nov 25, 2023. It is now read-only.
This repository was archived by the owner on Nov 25, 2023. It is now read-only.

1.0.0: pytest is failing #17

@kloczek

Description

@kloczek

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

On top of the 1.0.0 I'mm adding patch:

--- a/linecache2/tests/test_linecache.py        2015-03-06 01:33:05.000000000 +0000
+++ b/linecache2/tests/test_linecache.py        2021-12-26 06:31:03.915721698 +0000
@@ -1,7 +1,7 @@
 """ Tests for the linecache module """

 import linecache2 as linecache
-import unittest2 as unittest
+import unittest
 import os.path
 import tempfile

Which allows use standart unitetst instead unitest2.

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-linecache2-1.0.0-32.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-linecache2-1.0.0-32.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --deselect tests/test_linecache.py::LineCacheTests::test_lazycache_already_cached --deselect tests/test_linecache.py::LineCacheTests::test_lazycache_smoke
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
Using --randomly-seed=2491370604
rootdir: /home/tkloczko/rpmbuild/BUILD/linecache2-1.0.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 10 items

linecache2/tests/test_linecache.py ..F..F....                                                                                                                        [100%]

================================================================================= FAILURES =================================================================================
_______________________________________________________________ LineCacheTests.test_lazycache_already_cached _______________________________________________________________

self = <linecache2.tests.test_linecache.LineCacheTests testMethod=test_lazycache_already_cached>

    @unittest.skipIf("__loader__" not in globals(), "Modules not PEP302 by default")
    def test_lazycache_already_cached(self):
        linecache.clearcache()
        lines = linecache.getlines(NONEXISTENT_FILENAME, globals())
        self.assertEqual(
            False,
            linecache.lazycache(NONEXISTENT_FILENAME, globals()))
>       self.assertEqual(4, len(linecache.cache[NONEXISTENT_FILENAME]))
E       KeyError: '/usr/lib64/python3.8/os.py.missing'

linecache2/tests/test_linecache.py:184: KeyError
___________________________________________________________________ LineCacheTests.test_lazycache_smoke ____________________________________________________________________

self = <linecache2.tests.test_linecache.LineCacheTests testMethod=test_lazycache_smoke>

    @unittest.skipIf("__loader__" not in globals(), "Modules not PEP302 by default")
    def test_lazycache_smoke(self):
        lines = linecache.getlines(NONEXISTENT_FILENAME, globals())
        linecache.clearcache()
>       self.assertEqual(
            True, linecache.lazycache(NONEXISTENT_FILENAME, globals()))
E       AssertionError: True != False

linecache2/tests/test_linecache.py:152: AssertionError
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/pytest_freezegun.py:17: 20 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 ==========================================================================
FAILED linecache2/tests/test_linecache.py::LineCacheTests::test_lazycache_already_cached - KeyError: '/usr/lib64/python3.8/os.py.missing'
FAILED linecache2/tests/test_linecache.py::LineCacheTests::test_lazycache_smoke - AssertionError: True != False
================================================================= 2 failed, 8 passed, 20 warnings in 0.28s =================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions