()
| 394 | |
| 395 | @pytest.fixture(scope="module") |
| 396 | def pythonpath_isolation_test(): |
| 397 | # type: () -> Iterator[PythonpathIsolationTest] |
| 398 | with temporary_dir() as temp_dir: |
| 399 | pythonpath = os.path.join(temp_dir, "one") |
| 400 | with safe_open(os.path.join(pythonpath, "foo.py"), "w") as fp: |
| 401 | fp.write("BAR = 42") |
| 402 | with safe_open(os.path.join(pythonpath, "bar.py"), "w") as fp: |
| 403 | fp.write("FOO = 137") |
| 404 | |
| 405 | dist_content = { |
| 406 | "setup.py": textwrap.dedent( |
| 407 | """ |
| 408 | from setuptools import setup |
| 409 | |
| 410 | setup( |
| 411 | name='foo', |
| 412 | version='0.0.0', |
| 413 | zip_safe=True, |
| 414 | packages=['foo'], |
| 415 | install_requires=[], |
| 416 | ) |
| 417 | """ |
| 418 | ), |
| 419 | "foo/__init__.py": "BAR = 137", |
| 420 | } |
| 421 | |
| 422 | with temporary_content(dist_content) as project_dir: |
| 423 | foo_bdist = install_wheel(WheelBuilder(project_dir).bdist()) |
| 424 | |
| 425 | exe_contents = textwrap.dedent( |
| 426 | """ |
| 427 | import sys |
| 428 | |
| 429 | try: |
| 430 | import bar |
| 431 | except ImportError: |
| 432 | import collections |
| 433 | bar = collections.namedtuple('bar', ['FOO'])(None) |
| 434 | |
| 435 | import foo |
| 436 | |
| 437 | sys.stdout.write("foo.BAR={} bar.FOO={}".format(foo.BAR, bar.FOO)) |
| 438 | """ |
| 439 | ) |
| 440 | |
| 441 | yield PythonpathIsolationTest( |
| 442 | pythonpath=pythonpath, dists=[foo_bdist], exe=exe_contents |
| 443 | ) |
| 444 | |
| 445 | |
| 446 | def test_pythonpath_isolation_inherit_path_false(pythonpath_isolation_test): |
nothing calls this directly
no test coverage detected