Index: flake8_pyi-23.1.2/tests/test_pyi_files.py =================================================================== --- flake8_pyi-23.1.2.orig/tests/test_pyi_files.py +++ flake8_pyi-23.1.2/tests/test_pyi_files.py @@ -35,16 +35,21 @@ def test_pyi_file(path: str) -> None: message = line[match.end() : end_pos].strip() expected_output += f"{path}:{lineno}: {match.group(1)}{message}\n" + pythonpath = os.environ.get("PYTHONPATH") + pythonpath = f"PYTHONPATH={pythonpath}:." + run_results = [ # Passing a file on command line subprocess.run( - ["flake8", "-j0", *flags, path], + " ".join([pythonpath, "flake8", "-j0", *flags, path]), + shell=True, env={**os.environ, "PYTHONPATH": "."}, stdout=subprocess.PIPE, ), # Passing "-" as the file, and reading from stdin instead subprocess.run( - ["flake8", "-j0", "--stdin-display-name", path, *flags, "-"], + " ".join([pythonpath, "flake8", "-j0", "--stdin-display-name", path, *flags, "-"]), + shell=True, env={**os.environ, "PYTHONPATH": "."}, input=file_contents.encode("utf-8"), stdout=subprocess.PIPE,