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

pytest support with the next pytest release #91

Open
15r10nk opened this issue Nov 4, 2024 · 0 comments
Open

pytest support with the next pytest release #91

15r10nk opened this issue Nov 4, 2024 · 0 comments

Comments

@15r10nk
Copy link
Collaborator

15r10nk commented Nov 4, 2024

I fixed the source positions in pytest which will allow executing to find the correct nodes (if used with the next pytest release).

pytest-dev/pytest#12815

The only thing which seems to be missing now is to fix the tests in executing.

❯ pytest
============================================================================================================= test session starts =============================================================================================================
platform linux -- Python 3.12.6, pytest-8.4.0.dev100+g5c25c5929, pluggy-1.5.0
rootdir: /home/frank/projects/executing
configfile: pyproject.toml
collected 209 items                                                                                                                                                                                                                           

tests/test_ipython.py ..                                                                                                                                                                                                                [  0%]
tests/test_main.py ..................ss...............................................................................................................................................................sssssssssssssss.                  [ 94%]
tests/test_pytest.py .....F......                                                                                                                                                                                                       [100%]

================================================================================================================== FAILURES ===================================================================================================================
___________________________________________________________________________________________________________ test_exception_catching ___________________________________________________________________________________________________________

    def test_exception_catching():
        frame = inspect.currentframe()
    
        executing.executing.TESTING = True  # this is already the case in all other tests
        # Sanity check that this operation usually raises an exception.
        # This actually depends on executing not working in the presence of pytest.
        with pytest.raises((NotOneValueFound, KnownIssue)):
>           assert Source.executing(frame).node is None
E           AssertionError: assert <ast.Call object at 0x7f7999d49390> is None
E            +  where <ast.Call object at 0x7f7999d49390> = <executing.executing.Executing object at 0x7f799a0a00b0>.node
E            +    where <executing.executing.Executing object at 0x7f799a0a00b0> = executing(<frame at 0x7f799a2420e0, file '/home/frank/projects/executing/tests/test_pytest.py', line 131, code test_exception_catching>)
E            +      where executing = Source.executing

tests/test_pytest.py:131: AssertionError
============================================================================================================== warnings summary ===============================================================================================================
tests/test_main.py::test_small_samples[4851dc1b626a95e97dbe0c53f96099d165b755dd1bd552c6ca771f7bca6d30f5.py]
  /home/frank/projects/executing/tests/small_samples/4851dc1b626a95e97dbe0c53f96099d165b755dd1bd552c6ca771f7bca6d30f5.py:16: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
    if 1 < 1 > 1 == 1 >= 1 <= 1 != 1 in 1 not in 1 is 1 is not 1:

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================================================================================================== short test summary info ===========================================================================================================
FAILED tests/test_pytest.py::test_exception_catching - AssertionError: assert <ast.Call object at 0x7f7999d49390> is None
============================================================================================ 1 failed, 191 passed, 17 skipped, 1 warning in 7.26s =============================================================================================
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

1 participant