summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd_line_script.py
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Merged revisions ↵Nick Coghlan2009-11-161-102/+28
| | | | | | | | | | | | | | | | | | | | 76286-76287,76289-76294,76296-76299,76301-76305,76307,76310-76311,76313-76322 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76286 | nick.coghlan | 2009-11-15 17:30:34 +1000 (Sun, 15 Nov 2009) | 1 line Issue #6816: expose the zipfile and directory execution mechanism to Python code via the runpy module. Also consolidated some script execution functionality in the test harness into a helper module and removed some implementation details from the runpy module documentation. ........ r76321 | nick.coghlan | 2009-11-16 13:55:51 +1000 (Mon, 16 Nov 2009) | 1 line Account for another cache when hunting ref leaks ........ r76322 | nick.coghlan | 2009-11-16 13:57:32 +1000 (Mon, 16 Nov 2009) | 1 line Allow for backslashes in file paths passed to the regex engine ........
* convert old fail* assertions to assert*Benjamin Peterson2009-06-301-4/+4
|
* Merged revisions 69419-69420 via svnmerge fromNick Coghlan2009-02-081-1/+64
| | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r69419 | nick.coghlan | 2009-02-08 11:26:34 +1000 (Sun, 08 Feb 2009) | 1 line Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda) ........ r69420 | nick.coghlan | 2009-02-08 11:46:01 +1000 (Sun, 08 Feb 2009) | 1 line Mention patch submitter in NEWS entry for r69419 ........
* Merged revisions 67750-67751 via svnmerge fromNick Coghlan2008-12-141-14/+55
| | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r67750 | nick.coghlan | 2008-12-14 20:54:50 +1000 (Sun, 14 Dec 2008) | 1 line Fix several issues relating to access to source code inside zipfiles. Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details. ........ r67751 | nick.coghlan | 2008-12-14 21:09:40 +1000 (Sun, 14 Dec 2008) | 1 line Add file that was missed from r67750 ........
* #2621 rename test.test_support to test.supportBenjamin Peterson2008-05-201-5/+5
|