PY-25264: Do not access cwd in the middle of the test

We need to know which folder been used as current dir, but user
may change it while test is running so we shall not access it in the
middle of the test
This commit is contained in:
Ilya.Kazakevich
2017-07-21 21:15:11 +03:00
parent 40f3a77379
commit fb6570da9d
+3 -3
View File
@@ -18,7 +18,7 @@ if teamcity_presence_env_var not in os.environ:
# anything sent to stdout/stderr goes to IDE directly, not after test is over like it is done by default.
# out and err are not in sync, so output may go to wrong test
JB_DISABLE_BUFFERING = "JB_DISABLE_BUFFERING" in os.environ
PROJECT_DIR = os.getcwd()
def _parse_parametrized(part):
"""
@@ -179,7 +179,7 @@ class NewTeamcityServiceMessages(_old_service_messages):
loc = possible_location.find("(")
if loc > 0:
possible_location = possible_location[:loc].strip()
properties["locationHint"] = "python<{0}>://{1}".format(os.getcwd(), possible_location)
properties["locationHint"] = "python<{0}>://{1}".format(PROJECT_DIR, possible_location)
except KeyError:
# If message does not have name, then it is not test
# Simply pass it
@@ -399,4 +399,4 @@ def jb_doc_args(framework_name, args):
Runner encouraged to report its arguments to user with aid of this function
"""
print("Launching {0} with arguments {1} in {2}\n".format(framework_name, " ".join(args), os.getcwd()))
print("Launching {0} with arguments {1} in {2}\n".format(framework_name, " ".join(args), PROJECT_DIR))