Skip to content

Commit

Permalink
Prefer Path object for test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Jun 26, 2023
1 parent 33d7979 commit 02f375b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/test_modutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import astroid
from astroid import modutils
from astroid.const import PY310_PLUS, WIN32
from astroid.const import PY310_PLUS
from astroid.interpreter._import import spec

from . import resources
Expand Down Expand Up @@ -269,14 +269,11 @@ def test_std_lib(self) -> None:
)

def test_std_lib_found_before_same_named_package_on_path(self) -> None:
resource = resources.find("data")
sys.path.insert(0, resource)
sys.path.insert(0, resources.RESOURCE_PATH)
self.addCleanup(sys.path.pop, 0)
sys_path = str(sys.path)

file = modutils.file_from_modpath(["copy"])
if WIN32:
raise AssertionError('\n'.join([resource, sys_path, file]))

self.assertNotIn("test", file) # tests/testdata/python3/data/copy.py
self.assertTrue(any(stdlib in file for stdlib in modutils.STD_LIB_DIRS))

Expand Down

0 comments on commit 02f375b

Please sign in to comment.