forked from pex-tool/pex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removing testing modules from prod code.
Although these were harmless, removing them was made natural with the introduction of a dedicated test runner script which will be expanded to include spinning up a `devpi-server` in coming work to bring down integration test times.
- Loading branch information
Showing
154 changed files
with
379 additions
and
355 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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env python | ||
# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import print_function | ||
|
||
import os | ||
import re | ||
import subprocess | ||
import sys | ||
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser | ||
|
||
# Ensure the repo root is on the `sys.path` (for access to the pex and testing packages). | ||
os.environ["_PEX_TEST_PROJECT_DIR"] = str( | ||
subprocess.check_output(["git", "rev-parse", "--show-toplevel"]).decode("ascii").strip() | ||
) | ||
sys.path.insert(0, os.environ["_PEX_TEST_PROJECT_DIR"]) | ||
|
||
from testing import make_env, pex_project_dir | ||
|
||
|
||
def typechecking(): | ||
# type: () -> bool | ||
try: | ||
import typing | ||
|
||
return typing.TYPE_CHECKING | ||
except ImportError: | ||
return False | ||
|
||
|
||
if typechecking(): | ||
from typing import Iterator, Tuple | ||
|
||
|
||
def iter_test_control_env_vars(): | ||
# type: () -> Iterator[Tuple[str, str]] | ||
for var, value in sorted(os.environ.items()): | ||
if re.search(r"(PEX|PYTHON)", var) and var != "PYTHONHASHSEED": | ||
yield var, value | ||
|
||
|
||
def main(): | ||
# type: () -> int | ||
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter) | ||
parser.add_argument( | ||
"--", | ||
dest="passthrough_args", | ||
metavar="ARG", | ||
nargs="*", | ||
help="All arguments following -- are passed to pytest.", | ||
) | ||
options, passthrough_args = parser.parse_known_args() | ||
|
||
test_control_env_vars = list(iter_test_control_env_vars()) | ||
if test_control_env_vars: | ||
print("Test control environment variables:") | ||
for var, value in test_control_env_vars: | ||
print("{var}={value}".format(var=var, value=value)) | ||
else: | ||
print("No test control environment variables set.") | ||
|
||
return subprocess.call( | ||
args=["pytest"] + passthrough_args[1:], | ||
cwd=pex_project_dir(), | ||
# N.B.: The pytest console script needs this to see the Pex project dir on the sys.path; | ||
# cwd is not enough. | ||
env=make_env(PYTHONPATH=pex_project_dir()), | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
File renamed without changes.
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
File renamed without changes.
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
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
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
Oops, something went wrong.