summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line_script.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-34726: Fix handling of hash-based pycs in zipimport. (GH-10327)Elvis Pranskevichus2018-11-071-2/+24
| | | | | | | | Current support for hash-based bytecode files in `zipimport` is rather sparse, which leads to test failures when the test suite is ran with the ``SOURCE_DATE_EPOCH`` environment variable set. This teaches zipimport to handle hash-based pycs properly.
* bpo-32236: open() emits RuntimeWarning if buffering=1 for binary mode (GH-4842)Alexey Izbyshev2018-10-201-2/+2
| | | | | | | | | If buffering=1 is specified for open() in binary mode, it is silently treated as buffering=-1 (i.e., the default buffer size). Coupled with the fact that line buffering is always supported in Python 2, such behavior caused several issues (e.g., bpo-10344, bpo-21332). Warn that line buffering is not supported if open() is called with binary mode and buffering=1.
* bpo-34783: Fix test_nonexisting_script() (GH-9896)Victor Stinner2018-10-151-8/+1
| | | | | | Fix test_cmd_line_script.test_nonexisting_script(): the test must not rely on sys.executable, since main.c uses config->program which can be different than sys.executable in many cases (for example, on macOS when using the framework).
* bpo-34783: Disable test_nonexisting_script for macOS framework builds (GH-9831)Ned Deily2018-10-131-0/+4
| | | | | | | | | With macOS framework builds, test case test_nonexisting_script in test_nonexisting_script fails because the test case assumes that the file name in sys.executable will appear in the error message. For macOS framework builds, sys.executable is the file name of the stub launcher and its file name bears no relationship to the file name of the actual python executable. For now, skip the test in this case.
* bpo-34783: Add test_cmd_line_script.test_nonexisting_script() (GH-9535)Victor Stinner2018-09-241-0/+19
| | | | Make sure that "./python script.py" does not crash if the script file doesn't exist.
* bpo-33053: Remove test_cmd_line_script debugging print (GH-6237)Nick Coghlan2018-03-251-2/+0
| | | | I noticed this had slipped into the original commit when resolving a merge conflict for the backport to 3.7.
* bpo-33053: -m now adds *starting* directory to sys.path (GH-6231)Nick Coghlan2018-03-251-56/+48
| | | | | | | | | | | | Historically, -m added the empty string as sys.path zero, meaning it resolved imports against the current working directory, the same way -c and the interactive prompt do. This changes the sys.path initialisation to add the *starting* working directory as sys.path[0] instead, such that changes to the working directory while the program is running will have no effect on imports when using the -m switch.
* bpo-30436: Raise ModuleNotFoundError for importlib.util.find_spec() when ↵Milan Oberkirch2017-06-141-1/+1
| | | | | parent isn't a package (GH-1899) Previously AttributeError was raised, but that's not very reflective of the fact that the requested module can't be found since the specified parent isn't actually a package.
* bpo-29723: Consistently configure sys.path[0] (#575)Nick Coghlan2017-03-121-0/+67
| | | | | | | | | | | | | | | | | | | | | | Directory and zipfile execution previously added the parent directory of the directory or zipfile as sys.path[0] and then subsequently overwrote it with the directory or zipfile itself. This caused problems in isolated mode, as it overwrote the "stdlib as a zip archive" entry in sys.path, as the parent directory was never added. The attempted fix to that issue in bpo-29319 created the opposite problem in *non*-isolated mode, by potentially leaving the parent directory on sys.path instead of overwriting it. This change fixes the root cause of the problem by removing the whole "add-and-overwrite" dance for sys.path[0], and instead simply never adds the parent directory to sys.path in the first place.
* Issue #25677: Merge SyntaxError caret positioning from 3.5Martin Panter2016-12-191-0/+33
|\
| * Issue #25677: Correct syntax error caret for indented blocks.Martin Panter2016-12-111-0/+33
| | | | | | | | Based on patch by Michael Layzell.
* | Issue #15767: Use ModuleNotFoundError.Eric Snow2016-09-071-1/+1
| |
* | Issue #27487: Merge runpy warning from 3.5Martin Panter2016-08-211-3/+5
|\ \ | |/
| * Issue #27487: Warn if submodule already imported before runpy executionMartin Panter2016-08-211-3/+5
| | | | | | | | Also try to clarify the find_spec() error message.
* | Backed out changeset af29d89083b3 (closes #25548) (closes #27498)Benjamin Peterson2016-07-141-8/+1
| |
* | Issue #25548: Showing memory address of class objects in replKushal Das2016-06-041-1/+8
| |
* | Issue #26304: Merge doc wording from 3.5Martin Panter2016-02-101-1/+1
|\ \ | |/
| * Issue #26304: Change "allows to <verb>" to "allows <verb>ing" or similarMartin Panter2016-02-101-1/+1
| | | | | | | | | | The original form is incorrect grammar and feels awkward, even though the meaning is clear.
* | subprocess._optim_args_from_interpreter_flags()Victor Stinner2016-01-181-3/+2
|/ | | | | | | | | | | | Issue #26100: * Add subprocess._optim_args_from_interpreter_flags() * Add test.support.optim_args_from_interpreter_flags() * Use new functions in distutils, test_cmd_line_script, test_compileall and test_inspect The change enables test_details() test of test_inspect when -O or -OO command line option is used.
* Issue #19771: Omit irrelevant message if package could not be initializedMartin Panter2015-12-121-0/+13
|
* Issue #14285: Do not catch exceptions initializing any ancestor packageMartin Panter2015-12-101-0/+1
| | | | | | | | The previous fix only handled the case of the parent package of __main__ failing to initialize. Also make the "Error while finding spec" formatting slightly more appealing, and document and test that the module name must be absolute.
* Issue #14285: Do not catch __init__.py exceptions in runpyMartin Panter2015-12-031-9/+62
| | | | | | | | | | Initialize package before calling find_spec() for __main__, so that we do not incorrectly handle exceptions from __init__.py. When runpy is used from the Python CLI, use an internal exception rather than ImportError, to avoid catching unexpected exceptions. Also remove exception message rewriting in _run_module_as_main(), because it seems to be redundant with the _get_main_module_details() function.
* Issue #9517: Move script_helper to the support package.Berker Peksag2015-05-061-24/+23
| | | | Patch by Christie Wilson.
* Fixed bytes warnings when run tests with -vv.Serhiy Storchaka2015-03-241-5/+5
|
* Issue #21425: Fix flushing of standard streams in the interactive interpreter.Antoine Pitrou2014-05-111-0/+49
|
* Close #20500: Don't trigger PyObject_Str assertion at shutdownNick Coghlan2014-02-091-0/+18
|
* Issue #19700: set __spec__ appropriately in runpyNick Coghlan2013-12-151-1/+18
| | | | | | | | Note that __spec__.name is not currently guaranteed to be in sys.modules when the code is running, only __name__ is. The "running module is in sys.modules" invariant will be expanded to also cover __spec__.name in a subsequent patch.
* Close #18754: Run Python child processes in isolated more in the test suite.Victor Stinner2013-10-121-4/+6
|
* Close #15415: Factor out temp dir helpers to test.supportNick Coghlan2013-07-281-4/+4
| | | | Patch by Chris Jerdonek
* (Merge 3.2) Issue #16218, #16414, #16444: Backport FS_NONASCII,Victor Stinner2013-01-031-5/+4
|\ | | | | | | | | TESTFN_UNDECODABLE, TESTFN_NONASCII of test.support from Python 3.4. Backport tests on non-ASCII paths.
| * Issue #16218, #16414, #16444: Backport FS_NONASCII, TESTFN_UNDECODABLE,Victor Stinner2013-01-031-0/+24
| | | | | | | | | | TESTFN_NONASCII of test.support from Python 3.4. Backport tests on non-ASCII paths.
* | Issue #16218, #16444: Backport improvment on tests for non-ASCII charactersVictor Stinner2012-11-121-7/+23
| |
* | Issue #16218: Support non ascii characters in python launcher.Andrew Svetlov2012-11-011-0/+9
| | | | | | | | Patch by Serhiy Storchaka.
* | Fix typo in a comment (noticed by Terry Reedy)Nick Coghlan2012-07-151-1/+1
| |
* | Actually initialize __main__.__loader__ with loader instances, not the ↵Nick Coghlan2012-07-151-1/+2
| | | | | | | | corresponding type objects
* | Note why we can't write an automated test for the code path that brings up ↵Nick Coghlan2012-07-151-0/+3
| | | | | | | | the REPL for a bare 'python' call
* | Take the first step in resolving the messy pkgutil vs importlib edge cases ↵Nick Coghlan2012-07-151-17/+56
| | | | | | | | by basing pkgutil explicitly on importlib, deprecating its internal import emulation and setting __main__.__loader__ correctly so that runpy still works (Affects #15343, #15314, #15357)
* | Fix issue # 15033 - Return the proper exitcode for failure when modules are ↵Senthil Kumaran2012-07-051-0/+15
|\ \ | |/ | | | | invoked using -m switch. Patch contributed by Jeff Knupp
| * Fix issue # 15033 - Return the proper exitcode for failure when modules are ↵Senthil Kumaran2012-07-051-0/+15
| | | | | | | | invoked using -m switch. Patch contributed by Jeff Knupp
* | Close #14136 by cleaning up the PEP 409 command line test (patch by Ethan ↵Nick Coghlan2012-05-211-0/+19
| | | | | | | | Furman)
* | Issue #14605: Make explicit the entries on sys.path_hooks that used toBrett Cannon2012-04-261-4/+11
|/ | | | | | | | | | | | be implicit. Added a warning for when sys.path_hooks is found to be empty. Also changed the meaning of None in sys.path_importer_cache to represent trying sys.path_hooks again (an interpretation of previous semantics). Also added a warning for when None was found. The long-term goal is for None in sys.path_importer_cache to represent the same as imp.NullImporter: no finder found for that sys.path entry.
* Close issue #14026 by better testing sys.argv handling in ↵Nick Coghlan2012-04-221-3/+8
| | | | test_cmd_line_script (patch by Jason Yeo)
* Close #14032: fix incorrect variable reference in test_cmd_line_scriptNick Coghlan2012-04-191-1/+1
|
* test_cmd_line_script: format paths with ascii() instead of repr()Victor Stinner2010-10-171-8/+8
| | | | | Fix the test if the native filesystem encoding is not utf-8 (eg. cp1250 on Windows).
* #9964: fix running test_cmd_line_script under -O and -OO.Georg Brandl2010-10-141-0/+3
|
* Better Python spawning primitives in test.script_helper, forAntoine Pitrou2010-10-081-17/+15
| | | | easier writing of unit tests and better error reporting.
* Issue #8202: Set sys.argv[0] to -m rather than -c while searching for the ↵Nick Coghlan2010-08-171-29/+92
| | | | module to execute. Also updates all the cmd_line_script tests to validate the setting of sys.path[0] and the current working directory
* PEP 3147Barry Warsaw2010-04-171-12/+18
|
* Merged revisions 78093 via svnmerge fromGeorg Brandl2010-03-141-2/+1
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r78093 | georg.brandl | 2010-02-07 18:03:15 +0100 (So, 07 Feb 2010) | 1 line Remove unused imports in test modules. ........
* use assert[Not]In where appropriateBenjamin Peterson2010-01-191-4/+4
| | | | A patch from Dave Malcolm.