summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compileall.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-43651: Fix test_compileall with PEP 597 (GH-25128)Inada Naoki2021-04-021-7/+6
|
* bpo-40692: Run more test_concurrent_futures tests (GH-20239)Asheesh Laroia2021-02-081-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of multiprocessing.synchronize() being missing, the test_concurrent_futures test suite now skips only the tests that require multiprocessing.synchronize(). Validate that multiprocessing.synchronize exists as part of _check_system_limits(), allowing ProcessPoolExecutor to raise NotImplementedError during __init__, rather than crashing with ImportError during __init__ when creating a lock imported from multiprocessing.synchronize. Use _check_system_limits() to disable tests of ProcessPoolExecutor on systems without multiprocessing.synchronize. Running the test suite without multiprocessing.synchronize reveals that Lib/compileall.py crashes when it uses a ProcessPoolExecutor. Therefore, change Lib/compileall.py to call _check_system_limits() before creating the ProcessPoolExecutor. Note that both Lib/compileall.py and Lib/test/test_compileall.py were attempting to sanity-check ProcessPoolExecutor by expecting ImportError. In multiprocessing.resource_tracker, sem_unlink() is also absent on platforms where POSIX semaphores aren't available. Avoid using sem_unlink() if it, too, does not exist. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-40275: Use new test.support helper submodules in tests (GH-21314)Hai Shi2020-07-061-5/+6
|
* bpo-41069: Make TESTFN and the CWD for tests containing non-ascii ↵Serhiy Storchaka2020-06-251-2/+4
| | | | characters. (GH-21035)
* bpo-40495: compileall option to hardlink duplicate pyc files (GH-19901)Lumír 'Frenzy' Balhar2020-05-141-3/+221
| | | | | | | compileall is now able to use hardlinks to prevent duplicates in a case when .pyc files for different optimization levels have the same content. Co-authored-by: Miro Hrončok <miro@hroncok.cz> Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40443: Remove unused imports in tests (GH-19804)Victor Stinner2020-04-301-1/+0
|
* bpo-39769: Fix compileall ddir for subpkgs. (GH-18676)Gregory P. Smith2020-02-291-0/+41
| | | | | | | | | | Fix compileall.compile_dir() ddir= behavior on sub-packages. Fixes compileall.compile_dir's ddir parameter and compileall command line flag `-d` to no longer write the wrong pathname to the generated pyc file for submodules beneath the root of the directory tree being compiled. This fixes a regression introduced with Python 3.5. Also marks the _new_ in 3.9 from PR #16012 parameters to compile_dir as keyword only (as that is the only way they will be used) and fixes an omission of them in one place from the docs.
* bpo-38470: Fix test_compileall.test_compile_dir_maxlevels() (GH-16789)Victor Stinner2019-10-151-59/+15
| | | | | | | | | Fix test_compile_dir_maxlevels() on Windows without long path support: only create 3 subdirectories instead of between 20 and 100 subdirectories. Fix also compile_dir() to use the current sys.getrecursionlimit() value as the default maxlevels value, rather than using sys.getrecursionlimit() value read at startup.
* compileall tests: Use shorter name for long_path test (GH-16419)Petr Viktorin2019-09-261-2/+6
| | | | Apparently, the path needs to be limited to 260 characters on (some versions of) Windows.
* bpo-38112: compileall: Skip long path path on Windows if the path can't be ↵Petr Viktorin2019-09-261-12/+51
| | | | | | | | | | | | created (GH-16414) This avoids the buildbot failure on Windows: ``` FileNotFoundError: [WinError 206] The filename or extension is too long: 'd:\\temp\\tmp5r3z438t\\long\\1\\2\\3\\4\\5\\6\\7\\8\\9\\10\\11\\12\\13\\14\\15\\16\\17\\18\\19\\20\\21\\22\\23\\24\\25\\26\\27\\28\\29\\30\\31\\32\\33\\34\\35\\36\\37\\38\\39\\40\\41\\42\\43\\44\\45\\46\\47\\48\\49\\50\\51\\52\\53\\54\\55\\56\\57\\58\\59\\60\\61\\62\\63\\64\\65\\66\\67\\68\\69\\70\\71\\72\\73\\74\\75\\76\\77\\78' ``` Creates a path that's long but avoids OS restrictions. https://bugs.python.org/issue38112
* bpo-38112: Compileall improvements (GH-16012)Lumír 'Frenzy' Balhar2019-09-261-0/+209
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Raise the limit of maximum path depth to actual recursion limit * Add posibilities to adjust a path compiled in .pyc file. Now, you can: - Strip a part of path from a beggining of path into compiled file example "-s /test /test/build/real/test.py" → "build/real/test.py" - Append some new path to a beggining of path into compiled file example "-p /boo real/test.py" → "/boo/real/test.py" You can also use both options in the same time. In that case, striping is done before appending. * Add a possibility to specify multiple optimization levels Each optimization level then leads to separated compiled file. Use `action='append'` instead of `nargs='+'` for the -o option. Instead of `-o 0 1 2`, specify `-o 0 -o 1 -o 2`. It's more to type, but much more explicit. * Add a symlinks limitation feature This feature allows us to limit byte-compilation of symbolic links if they are pointing outside specified dir (build root for example).
* Fix typos in comments, docs and test names (#15018)Min ho Kim2019-07-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | * Fix typos in comments, docs and test names * Update test_pyparse.py account for change in string length * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: Dealloccte -> Deallocate Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Update posixmodule checksum. * Reverse idlelib changes.
* bpo-36786: Run compileall in parallel during "make install" (GH-13078)Antoine Pitrou2019-05-151-1/+1
|
* Clean up code which checked presence of os.{stat,lstat,chmod} (#11643)Anthony Sottile2019-02-251-1/+0
|
* bpo-29877: compileall: import ProcessPoolExecutor only when needed (GH-4856)Dustin Spicuzza2018-11-231-4/+4
| | | | | | | Importing ProcessPoolExecutor may hang or cause an error when the import accesses urandom on a low resource platform https://bugs.python.org/issue29877
* bpo-34022: Stop forcing of hash-based invalidation with SOURCE_DATE_EPOCH ↵Elvis Pranskevichus2018-10-101-6/+44
| | | | | | | | | | | | | | | | | | | | (GH-9607) Unconditional forcing of ``CHECKED_HASH`` invalidation was introduced in 3.7.0 in bpo-29708. The change is bad, as it unconditionally overrides *invalidation_mode*, even if it was passed as an explicit argument to ``py_compile.compile()`` or ``compileall``. An environment variable should *never* override an explicit argument to a library function. That change leads to multiple test failures if the ``SOURCE_DATE_EPOCH`` environment variable is set. This changes ``py_compile.compile()`` to only look at ``SOURCE_DATE_EPOCH`` if no explicit *invalidation_mode* was specified. I also made various relevant tests run with explicit control over the value of ``SOURCE_DATE_EPOCH``. While looking at this, I noticed that ``zipimport`` does not work with hash-based .pycs _at all_, though I left the fixes for subsequent commits.
* closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)Benjamin Peterson2017-12-091-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | Python now supports checking bytecode cache up-to-dateness with a hash of the source contents rather than volatile source metadata. See the PEP for details. While a fairly straightforward idea, quite a lot of code had to be modified due to the pervasiveness of pyc implementation details in the codebase. Changes in this commit include: - The core changes to importlib to understand how to read, validate, and regenerate hash-based pycs. - Support for generating hash-based pycs in py_compile and compileall. - Modifications to our siphash implementation to support passing a custom key. We then expose it to importlib through _imp. - Updates to all places in the interpreter, standard library, and tests that manually generate or parse pyc files to grok the new format. - Support in the interpreter command line code for long options like --check-hash-based-pycs. - Tests and documentation for all of the above.
* Issue #28226: Fix test_compileall on WindowsBerker Peksag2016-09-301-3/+3
|
* Issue #28226: compileall now supports pathlibBerker Peksag2016-09-301-0/+23
|
* Issue #27322: Set sys.path to a temp dir in test_compile_pathBerker Peksag2016-09-281-13/+2
|
* Issue #27322: back out the commit. needs to be addressed after beta1.Christian Heimes2016-09-121-1/+0
|
* Issue #27322: skip test_compile_path when sys.path is not writeable.Christian Heimes2016-09-121-0/+1
|
* subprocess._optim_args_from_interpreter_flags()Victor Stinner2016-01-181-4/+3
| | | | | | | | | | | | 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.
* Fix test_compilepath() of test_compileallVictor Stinner2016-01-181-0/+12
| | | | | | Issue #26101: Exclude Lib/test/ from sys.path in test_compilepath(). The directory contains invalid Python files like Lib/test/badsyntax_pep3120.py, whereas the test ensures that all files can be compiled.
* Issue #25768: Make compileall functions return booleans and documentBrett Cannon2015-12-271-2/+24
| | | | | | the return values as well as test them. Thanks to Nicholas Chammas for the bug report and initial patch.
* Merge: #24903: Remove misleading error message to fix regression.R David Murray2015-12-051-8/+0
|\
| * #24903: Remove misleading error message to fix regression.R David Murray2015-12-051-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | Before the argparse conversion, compileall would (sometimes) accept multiple paths when -d was specified. Afterward, it does not. The corresponding check in the original code claimed to prevent multiple *directories* from being specified...but it didn't really work even to do that. So this patch fixes the regression by invoking the consenting adults rule: if you specify a combination of arguments to compileall that produces files with inconsistent destdirs (which you could do before), it is on you. Patch by Jake Garver.
| * Issue #25099: Skip relevant tests in test_compileall when an entry onBrett Cannon2015-10-091-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | sys.path has an unwritable __pycache__ directory. This typically comes up when someone runs the test suite from an administrative install of Python on Windows where the user does not have write permissions to the stdlib's directory. Thanks to Zachary Ware and Matthias Klose for reporting bugs related to this issue. (grafted from 34bbd537b3e688dfbb6498e9083445a6a72fc4b1)
* | Issue #25099: Skip relevant tests in test_compileall when an entry onBrett Cannon2015-10-091-4/+32
| | | | | | | | | | | | | | | | | | | | | | sys.path has an unwritable __pycache__ directory. This typically comes up when someone runs the test suite from an administrative install of Python on Windows where the user does not have write permissions to the stdlib's directory. Thanks to Zachary Ware and Matthias Klose for reporting bugs related to this issue.
* | Issue #9517: Move script_helper to the support package.Berker Peksag2015-05-061-1/+2
| | | | | | | | Patch by Christie Wilson.
* | Issue #23917: Fall back to sequential compilation when ProcessPoolExecutor ↵Berker Peksag2015-04-221-4/+4
| | | | | | | | | | | | doesn't exist. Patch by Claudiu Popa.
* | Issue #23731: Implement PEP 488.Brett Cannon2015-04-131-11/+10
| | | | | | | | | | | | The concept of .pyo files no longer exists. Now .pyc files have an optional `opt-` tag which specifies if any extra optimizations beyond the peepholer were applied.
* | Issue #21338: Add silent mode for compileall.Berker Peksag2014-10-151-0/+7
| | | | | | | | | | | | | | | | | | quiet parameters of compile_{dir, file, path} functions now have a multilevel value. Also, -q option of the CLI now have a multilevel value. Patch by Thomas Kluyver.
* | Issue #16104: Allow compileall to do parallel bytecode compilation.Brett Cannon2014-09-121-0/+57
| | | | | | | | | | | | | | Both compileall.compile_dir() and the CLI for compileall now allow for specifying how many workers to use (or 0 to use all CPUs). Thanks to Claudiu Popa for the patch.
* | allow recursion depth to be specified (closes #19628)Benjamin Peterson2014-08-191-0/+34
|/ | | | Patch from Claudiu Popa.
* Merge: #19532: make compileall with no file/dir args respect -f and -q.R David Murray2013-12-161-2/+23
|\
| * #19532: make compileall with no file/dir args respect -f and -q.R David Murray2013-12-161-0/+23
| | | | | | | | Patch by Vajrasky Kok.
| * Issue #18702: All skipped tests now reported as skipped.Serhiy Storchaka2013-11-031-2/+1
| |
* | Issue #18702: All skipped tests now reported as skipped.Serhiy Storchaka2013-11-031-2/+1
| |
* | Close #18754: Run Python child processes in isolated more in the test suite.Victor Stinner2013-10-121-1/+1
| |
* | Issue #17177: stop using imp for compileall.Brett Cannon2013-06-151-27/+23
|/
* fix test_compileall when run with -O[O]Benjamin Peterson2012-09-251-4/+12
|
* #11873: another try at fixing the regex, courtesy of Victor StinnerR David Murray2011-07-011-1/+1
|
* #11873: fix test regex so it covers windows os.sep as well.R David Murray2011-07-011-1/+1
|
* Issue #11169: compileall module uses repr() to format filenames and paths toVictor Stinner2011-05-101-1/+1
| | | | escape surrogate characters and show spaces.
* #11873: Improve test regex so random directory names don't cause test to failR David Murray2011-05-051-1/+1
|
* #11132: pass optimize parameter to recursive call in ↵Georg Brandl2011-02-071-0/+10
| | | | compileall.compile_dir(). Reviewed by Eric A.
* Make test_compileall more robust by using -S to keep sys.path minimized.R. David Murray2010-12-211-2/+2
| | | | | | | | | Try this again, hopefully the right way this time. Arfrever Taifersar Arahesis reported that test_compileall failed during Gentoo install because it was tyring to write .pyc files to a read-only system directory during test_no_args_compiles_path. Having the tests call python with -S should eliminate the system directories from the path.
* Revert incorrect patch made at the wrong time.R. David Murray2010-12-201-1/+1
|
* Make test_compileall more robust by using -S to keep sys.path minimized.R. David Murray2010-12-201-1/+1
| | | | | | | Arfrever Taifersar Arahesis reported that test_compileall failed during Gentoo install because it was tyring to write .pyc files to a read-only system directory during test_no_args_compiles_path. Having subprocess call python with -S should eliminate the system directories from the path.