This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_script_helper fails on Windows when run from the source code directory
Type: Stage: resolved
Components: Tests Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: LorenzMende, abrezovsky, ethan smith, miss-islington, terry.reedy, vstinner
Priority: normal Keywords: patch

Created on 2018-02-24 23:07 by abrezovsky, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8034 merged LorenzMende, 2018-06-30 21:58
PR 8087 merged miss-islington, 2018-07-04 10:11
PR 8088 merged miss-islington, 2018-07-04 10:12
Messages (11)
msg312765 - (view) Author: Andrew Brezovsky (abrezovsky) * Date: 2018-02-24 23:07
Test test_script_helper fails, details:

Running Debug|Win32 interpreter...
== CPython 3.8.0a0 (heads/master:6cdb7954b0, Feb 24 2018, 17:25:46) [MSC v.1912 32 bit (Intel)]
== Windows-10-10.0.16299-SP0 little-endian
== cwd: \cpython\build\test_python_7920
== CPU count: 4
== encodings: locale=cp1252, FS=utf-8
Run tests sequentially
0:00:00 [1/1] test_script_helper
test_assert_python_failure (test.test_script_helper.TestScriptHelper) ... ok
test_assert_python_failure_raises (test.test_script_helper.TestScriptHelper) ... ok
test_assert_python_isolated_when_env_not_required (test.test_script_helper.TestScriptHelper) ... ok
test_assert_python_not_isolated_when_env_is_required (test.test_script_helper.TestScriptHelper)
Ensure that -I is not passed when the environment is required. ... ok
test_assert_python_ok (test.test_script_helper.TestScriptHelper) ... ok
test_assert_python_ok_raises (test.test_script_helper.TestScriptHelper) ... ok
test_interpreter_requires_environment_details (test.test_script_helper.TestScriptHelperEnvironment) ... FAIL
test_interpreter_requires_environment_false (test.test_script_helper.TestScriptHelperEnvironment) ... FAIL
test_interpreter_requires_environment_true (test.test_script_helper.TestScriptHelperEnvironment) ... FAIL

======================================================================
FAIL: test_interpreter_requires_environment_details (test.test_script_helper.TestScriptHelperEnvironment)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\andor\Documents\Projects\cpython\lib\unittest\mock.py", line 1191, in patched
    return func(*args, **keywargs)
  File "C:\Users\andor\Documents\Projects\cpython\lib\test\test_script_helper.py", line 101, in test_interpreter_requires_environment_details
    self.assertFalse(script_helper.interpreter_requires_environment())
AssertionError: True is not false

======================================================================
FAIL: test_interpreter_requires_environment_false (test.test_script_helper.TestScriptHelperEnvironment)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\andor\Documents\Projects\cpython\lib\unittest\mock.py", line 1191, in patched
    return func(*args, **keywargs)
  File "C:\Users\andor\Documents\Projects\cpython\lib\test\test_script_helper.py", line 95, in test_interpreter_requires_environment_false
    self.assertFalse(script_helper.interpreter_requires_environment())
AssertionError: True is not false

======================================================================
FAIL: test_interpreter_requires_environment_true (test.test_script_helper.TestScriptHelperEnvironment)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\andor\Documents\Projects\cpython\lib\unittest\mock.py", line 1191, in patched
    return func(*args, **keywargs)
  File "C:\Users\andor\Documents\Projects\cpython\lib\test\test_script_helper.py", line 89, in test_interpreter_requires_environment_true
    self.assertEqual(1, mock_check_call.call_count)
AssertionError: 1 != 0

----------------------------------------------------------------------
Ran 9 tests in 0.240s

FAILED (failures=3)
test test_script_helper failed
test_script_helper failed

1 test failed:
    test_script_helper

Total duration: 281 ms
Tests result: FAILURE
msg316358 - (view) Author: Ethan Smith (ethan smith) * Date: 2018-05-10 10:55
For reference this is happening with a clean checkout and build of master for me, which seems like it shouldn't be the case...
msg320164 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-06-21 11:13
I confirm that I reproduce the issue on Windows when running "python -m test test_script_helper -v" from the source code directory, on 3.6, 3.7 and master branches.

Using Python 3.6 installed on the system (using python.org installer), the same command pass.
msg320324 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-23 19:20
Ditto with fresh update and build, except that I used installed 3.7.0rc1 (and it passed).  This is not regularly failing on the (Windows) buildbots, so there is something 'different' about the repository on some non-buildbot user machines.

I am pretty sure that I have run the full suite OK within the last month, certainly since last February.  The test has not been touched in 3 years.
msg320811 - (view) Author: Lorenz Mende (LorenzMende) * Date: 2018-06-30 22:00
I confirm the issue too.
I am running the tests on a win 10 Ver 1709, clean build.

Most likely the issue is caused by the changes from commit fa9a502a387a26ba116840d35ae4a30f672e78ad
at test.support.script_helper
The function in test was altered to support a different behaviour when run from CI. The related tests were not changed.

As I am relativly new to python-dev: Does the bot/ user machines differ in the existence of PYTHONHOME? (Then the passing of the bot runs are plausible)

The tests are modified/ one added. PR attached.
msg320815 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-30 23:32
f:\dev\3x>python -m test test_script_helper
...
test_script_helper failed

f:\dev\3x> git pr 8034
...
Switched to branch 'pr_8034'

f:\dev\3x>python -m test test_script_helper
...
== Tests result: SUCCESS ==
msg320816 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-30 23:37
Lorenz, welcome!  Please sign CLA so we can review and merge this.
msg321029 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-04 10:10
New changeset a390cb6b6fb6638e91d699513167e8f35b47f846 by Victor Stinner (Lorenz Mende) in branch 'master':
bpo-32942: Fix environment dependent test_script_helper (GH-8034)
https://github.com/python/cpython/commit/a390cb6b6fb6638e91d699513167e8f35b47f846
msg321032 - (view) Author: miss-islington (miss-islington) Date: 2018-07-04 10:35
New changeset 6b3ff35670869fb915d43ac434c473c1fc11598e by Miss Islington (bot) in branch '3.7':
bpo-32942: Fix environment dependent test_script_helper (GH-8034)
https://github.com/python/cpython/commit/6b3ff35670869fb915d43ac434c473c1fc11598e
msg321033 - (view) Author: miss-islington (miss-islington) Date: 2018-07-04 10:46
New changeset aea19a0530726c7ba6a9461b0024506529dc35e8 by Miss Islington (bot) in branch '3.6':
bpo-32942: Fix environment dependent test_script_helper (GH-8034)
https://github.com/python/cpython/commit/aea19a0530726c7ba6a9461b0024506529dc35e8
msg321034 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-04 10:51
Thank you Lorenz Mende for your fix, and Terry for your review! I tested manually the fix, and I confirm that it works (Terry also tested and confirmed that the fix works as expected).

I applied your fix to master, and backport it to 3.6 and 3.7. Python 2.7 has no test on script_helper, so it's not affected by this bug.
History
Date User Action Args
2022-04-11 14:58:58adminsetgithub: 77123
2018-07-04 10:51:28vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg321034

stage: patch review -> resolved
2018-07-04 10:46:18miss-islingtonsetmessages: + msg321033
2018-07-04 10:35:11miss-islingtonsetnosy: + miss-islington
messages: + msg321032
2018-07-04 10:12:31miss-islingtonsetpull_requests: + pull_request7689
2018-07-04 10:11:42miss-islingtonsetpull_requests: + pull_request7688
2018-07-04 10:10:18vstinnersetmessages: + msg321029
2018-06-30 23:37:31terry.reedysetmessages: + msg320816
2018-06-30 23:32:13terry.reedysetmessages: + msg320815
2018-06-30 22:00:45LorenzMendesetnosy: + LorenzMende
messages: + msg320811
2018-06-30 21:58:23LorenzMendesetkeywords: + patch
stage: patch review
pull_requests: + pull_request7643
2018-06-23 19:20:07terry.reedysetnosy: + terry.reedy
messages: + msg320324
2018-06-21 11:14:40vstinnersettitle: Regression: test_script_helper fails -> test_script_helper fails on Windows when run from the source code directory
2018-06-21 11:13:52vstinnersetnosy: + vstinner

messages: + msg320164
versions: + Python 3.6, Python 3.7
2018-05-10 10:55:35ethan smithsetnosy: + ethan smith
messages: + msg316358
2018-02-24 23:07:36abrezovskycreate