summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_compileall.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-120417: Add #noqa: F401 to tests (#120627)Victor Stinner2024-06-181-1/+1
| | | | Ignore linter "imported but unused" warnings in tests when the linter doesn't understand how the import is used.
* gh-119064: Use os_helper.FakePath instead of pathlib.Path in tests (GH-119065)Serhiy Storchaka2024-05-161-13/+13
|
* gh-117389: Fix `test_compileall.EncodingTest` (#117390)Nikita Sobolev2024-05-051-8/+14
|
* gh-71052: Add test exclusions to support running the test suite on Android ↵Malcolm Smith2024-02-291-1/+1
| | | | (#115918)
* gh-114075: Capture `test_compileall` stdout output (#114076)Kirill Podoprigora2024-01-151-1/+3
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-105931: Fix surprising compileall stripdir behaviour (GH-108671)hetmankp2023-10-231-0/+23
| | | | | | | | | | | | | | | | Before, the '-s STRIPDIR' option on compileall lead to some surprising results as it only strips away path components that match, but leaves alone the non-matching ones interspersed in between. For example, with: python -m compileall -s/path/to/another/src /path/to/build/src/file.py The resulting written path will be: build/file.py This fix only strips directories that are a fully matching prefix of the source path. If a stripdir is provided that is not a valid prefix, a warning will be displayed (which can be silenced with '-qq').
* gh-109295: Clean up multiprocessing in test_asyncio and test_compileall ↵Victor Stinner2023-09-121-3/+7
| | | | | | | (#109298) test_asyncio and test_compileall now clean up multiprocessing by calling multiprocessing _cleanup_tests(): explicitly clean up resources and stop background processes like the resource tracker.
* gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421)Serhiy Storchaka2023-09-021-0/+2
| | | | Only mark tests which spend significant system or user time, by itself or in subprocesses.
* bpo-40447: accept all path-like objects in compileall.compile_file (#19883)Filipe Laíns2022-12-231-0/+28
| | | | | | Signed-off-by: Filipe Laíns <lains@archlinux.org> Signed-off-by: Filipe Laíns <lains@riseup.net> Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-90473: Skip and document more failing tests on WASI (GH-93436)Christian Heimes2022-06-021-0/+3
| | | | | | | - Mark more ``umask()`` cases - ``dup()`` is not supported - ``/dev/null`` is not available - document missing features - mark more modules as not available
* bpo-47089: Avoid test_compileall failures on Windows (GH-32037)Jeremy Kloth2022-04-011-48/+36
|
* bpo-40280: Block more non-working syscalls in Emscripten (GH-31757)Christian Heimes2022-03-081-0/+4
| | | | | | | | | - getgroups always fails. - geteuid and getegid always return 0 (root), which confuse tarfile and tests. - hardlinks (link, linkat) always fails. - non-encodable file names are not supported by NODERAWFS layer. - mark more tests with dependency on subprocess and multiprocessing. Mocking does not work if the module fails to import.
* bpo-40280: Misc fixes for wasm32-emscripten (GH-30722)Christian Heimes2022-01-201-2/+2
|
* bpo-46425: Fix direct invocation of multiple test modules (GH-30666)Nikita Sobolev2022-01-181-4/+2
|
* bpo-45205: Make test_compileall quiet (GH-28356)Victor Stinner2021-09-151-2/+4
| | | | | Make test_compileall quiet: test_year_2038_mtime_compilation() and test_larger_than_32_bit_times() of test_compileall no longer log "Compiling ..." messages to stdout.
* bpo-34990: Treat the pyc header's mtime in compileall as an unsigned int ↵Ammar Askar2021-08-241-2/+21
| | | | | | (GH-19708) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
* bpo-44666: Use default encoding as fallback for compile_file (GH-27236)Stefan Hoelzl2021-07-301-0/+8
| | | | | | | When sys.stdout.encoding is None compile_file will fall back to sys.getdefaultencoding to encode/decode error messages. Co-authored-by: Stefan Hoelzl <stefan.hoelzl@posteo.de> Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
* 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.