Skip to content

Commit

Permalink
- fixed test failing with Python < 3.11;
Browse files Browse the repository at this point in the history
  • Loading branch information
jaltmayerpizzorno committed Aug 29, 2024
1 parent 2435fb2 commit a9e0d2d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions tests/test_codeinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import typing as T
import pytest
import coverup.codeinfo as codeinfo
import sys


codeinfo._debug = print # enables debugging
Expand All @@ -12,7 +13,6 @@
@pytest.fixture
def importlib_cleanup():
import importlib
import sys

previously_loaded = {m for m in sys.modules}

Expand Down Expand Up @@ -1104,17 +1104,28 @@ def foo(a, b):
)


def test_get_info_frozen_or_builtin_module(import_fixture):
@pytest.mark.skipif(sys.version_info[0:2] < (3,11), reason="not a frozen module then")
def test_get_info_frozen_module(import_fixture):
tmp_path = import_fixture

code = tmp_path / "foo.py"
code.write_text(textwrap.dedent("""\
import os
import sys
"""
))

tree = codeinfo.parse_file(code)
assert codeinfo.get_info(tree, 'os.path.join') == None


def test_get_info_builtin_module(import_fixture):
tmp_path = import_fixture

code = tmp_path / "foo.py"
code.write_text(textwrap.dedent("""\
import sys
"""
))

tree = codeinfo.parse_file(code)
assert codeinfo.get_info(tree, 'sys.path') == None

0 comments on commit a9e0d2d

Please sign in to comment.