Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.3.3: pytest is failing #120

Closed
kloczek opened this issue May 20, 2022 · 3 comments
Closed

0.3.3: pytest is failing #120

kloczek opened this issue May 20, 2022 · 3 comments

Comments

@kloczek
Copy link

kloczek commented May 20, 2022

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 --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-better_exceptions-0.3.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-better_exceptions-0.3.3-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/better-exceptions-0.3.3
plugins: black-0.3.12, asyncio-0.18.2
asyncio: mode=legacy
collected 1 item / 6 errors

================================================================================== ERRORS ==================================================================================
__________________________________________________________________ ERROR collecting test/test_chaining.py __________________________________________________________________
test/test_chaining.py:11: in cause
    div(x, y)
test/test_chaining.py:7: in div
    x / y
E   ZeroDivisionError: division by zero

During handling of the above exception, another exception occurred:
test/test_chaining.py:17: in context
    cause(x, y)
test/test_chaining.py:13: in cause
    raise ValueError("Division error")
E   ValueError: Division error

The above exception was the direct cause of the following exception:
test/test_chaining.py:21: in <module>
    context(1, 0)
test/test_chaining.py:19: in context
    raise ValueError("Cause error") from e
E   ValueError: Cause error
__________________________________________________________________ ERROR collecting test/test_encoding.py __________________________________________________________________
test/test_encoding.py:14: in <module>
    div()
test/test_encoding.py:11: in div
    return _deep("天")
test/test_encoding.py:8: in _deep
    return 1 / val
E   TypeError: unsupported operand type(s) for /: 'int' and 'str'
_____________________________________________________________ ERROR collecting test/test_indentation_error.py ______________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/python.py:614: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:533: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
    exec(co, module.__dict__)
test/test_indentation_error.py:13: in <module>
    exec(code)
E     File "<string>", line 4
E       print("foobar")  #intentional faulty indentation here.
E       ^
E   IndentationError: unexpected indent
________________________________________________________________ ERROR collecting test/test_syntax_error.py ________________________________________________________________
/usr/lib/python3.8/site-packages/_pytest/python.py:614: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:533: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
    exec(co, module.__dict__)
test/test_syntax_error.py:12: in <module>
    exec(code)
E     File "<string>", line 4
E       b = 7 *
E             ^
E   SyntaxError: invalid syntax
_________________________________________________________________ ERROR collecting test/test_truncating.py _________________________________________________________________
test/test_truncating.py:12: in <module>
    div()
test/test_truncating.py:9: in div
    return 1 / var
E   TypeError: unsupported operand type(s) for /: 'int' and 'str'
____________________________________________________________ ERROR collecting test/test_truncating_disabled.py _____________________________________________________________
test/test_truncating_disabled.py:12: in <module>
    div()
test/test_truncating_disabled.py:9: in div
    return 1 / var
E   TypeError: unsupported operand type(s) for /: 'int' and 'str'
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191
  /usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py:191: DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.
    config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
ERROR test/test_chaining.py - ValueError: Cause error
ERROR test/test_encoding.py - TypeError: unsupported operand type(s) for /: 'int' and 'str'
ERROR test/test_indentation_error.py
ERROR test/test_syntax_error.py
ERROR test/test_truncating.py - TypeError: unsupported operand type(s) for /: 'int' and 'str'
ERROR test/test_truncating_disabled.py - TypeError: unsupported operand type(s) for /: 'int' and 'str'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 6 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================= 1 warning, 6 errors in 0.32s =======================================================================
@Qix-
Copy link
Owner

Qix- commented May 20, 2022

We don't use pytest, hopefully nothing in the docs indicates this. test_all.sh is the test suite.

@Qix- Qix- closed this as completed May 20, 2022
@kloczek
Copy link
Author

kloczek commented May 20, 2022

You may not use pytest .. nevertheless pytest even against cyreewnt state of the code shows some code issues.

@Qix-
Copy link
Owner

Qix- commented May 20, 2022

I disagree. Tests run fine. You're using them incorrectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants