-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
122 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
6 changes: 6 additions & 0 deletions
6
plugins/org.python.pydev.core/pysrc/tests_runfiles/samples_integrated/root/test_in_root.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import unittest | ||
|
||
|
||
class MyTest(unittest.TestCase): | ||
def test1(self): | ||
print("--on-test-1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
plugins/org.python.pydev.core/pysrc/tests_runfiles/test_runfiles_integrated.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import os | ||
from subprocess import CompletedProcess | ||
import subprocess | ||
import sys | ||
from typing import Union, Literal, Optional, Dict | ||
import json | ||
|
||
|
||
def python_run( | ||
cmdline, | ||
returncode: Union[Literal["error"], Literal["any"], int], | ||
cwd=None, | ||
additional_env: Optional[Dict[str, str]] = None, | ||
timeout=None, | ||
) -> CompletedProcess: | ||
cp = os.environ.copy() | ||
cp["PYTHONPATH"] = os.pathsep.join([x for x in sys.path if x]) | ||
if additional_env: | ||
cp.update(additional_env) | ||
args = [sys.executable] + cmdline | ||
result = subprocess.run(args, capture_output=True, env=cp, cwd=cwd, timeout=timeout) | ||
|
||
if returncode == "any": | ||
return result | ||
|
||
if returncode == "error" and result.returncode: | ||
return result | ||
|
||
if result.returncode == returncode: | ||
return result | ||
|
||
# This is a bit too verbose, so, commented out for now. | ||
# env_str = "\n".join(str(x) for x in sorted(cp.items())) | ||
|
||
raise AssertionError( | ||
f"""Expected returncode: {returncode}. Found: {result.returncode}. | ||
=== stdout: | ||
{result.stdout.decode('utf-8')} | ||
=== stderr: | ||
{result.stderr.decode('utf-8')} | ||
=== Args: | ||
{args} | ||
""" | ||
) | ||
|
||
|
||
def test_runfiles_integrated(): | ||
project_rootdir = os.path.abspath(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
cwd = os.path.join(project_rootdir, "tests_runfiles", "samples_integrated") | ||
runfiles = os.path.join(project_rootdir, "runfiles.py") | ||
assert os.path.exists(cwd), f"{cwd} does not exist." | ||
env = {"PYDEV_RUNFILES_FILTER_TESTS": json.dumps({})} | ||
completed = python_run(["-Xfrozen_modules=off", runfiles, cwd], returncode=0, cwd=cwd, env=env) | ||
print(completed.stdout.decode("utf-8")) | ||
print(completed.stderr.decode("utf-8")) |