summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_netrc.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-89392: Remove test_main() in test_netrc (GH-108860) (GH-108868)Miss Islington (bot)2023-09-041-4/+2
| | | | | (cherry picked from commit 76f3c043b6c5971d5a13fc6decf87a80ddf7ef95) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.11] gh-108822: Backport libregrtest changes from the main branch (#108820)Victor Stinner2023-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Revert "[3.11] gh-101634: regrtest reports decoding error as failed test (#106169) (#106175)" This reverts commit d5418e97fc524420011a370ba3c2c3cf6a89a74f. * Revert "[3.11] bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (GH-30895) (GH-103342)" This reverts commit ecb09a849689764193e0115d27e220f82b5f6d9f. * Revert "gh-95027: Fix regrtest stdout encoding on Windows (GH-98492)" This reverts commit b2aa28eec56d07b9c6777b02b7247cf21839de9f. * Revert "[3.11] gh-94026: Buffer regrtest worker stdout in temporary file (GH-94253) (GH-94408)" This reverts commit 0122ab235b5acb52dd99fd05d8802a00f438b828. * Revert "Run Tools/scripts/reindent.py (GH-94225)" This reverts commit f0f3a424afb00a15ce8c0140dd218f5b33929be6. * Revert "gh-94052: Don't re-run failed tests with --python option (GH-94054)" This reverts commit 1347607db12012f6458ffcba48d8ad797083812e. * Revert "[3.11] gh-84461: Fix Emscripten umask and permission issues (GH-94002) (GH-94006)" This reverts commit 10731849184a3101ed18683b0128d689f1671c3f. * gh-93353: regrtest checks for leaked temporary files (#93776) When running tests with -jN, create a temporary directory per process and mark a test as "environment changed" if a test leaks a temporary file or directory. (cherry picked from commit e566ce5496f1bad81c431aaee65e36d5e44771c5) * gh-93353: Fix regrtest for -jN with N >= 2 (GH-93813) (cherry picked from commit 36934a16e86f34d69ba2d41630fb5b4d06d59cff) * gh-93353: regrtest supports checking tmp files with -j2 (#93909) regrtest now also implements checking for leaked temporary files and directories when using -jN for N >= 2. Use tempfile.mkdtemp() to create the temporary directory. Skip this check on WASI. (cherry picked from commit 4f85cec9e2077681b3dacc3108e646d509b720bf) * gh-84461: Fix Emscripten umask and permission issues (GH-94002) - Emscripten's default umask is too strict, see https://github.com/emscripten-core/emscripten/issues/17269 - getuid/getgid and geteuid/getegid are stubs that always return 0 (root). Disable effective uid/gid syscalls and fix tests that use chmod() current user. - Cannot drop X bit from directory. (cherry picked from commit 2702e408fd0e0dd7aec396b4cf8c7ce9caae81d8) * gh-94052: Don't re-run failed tests with --python option (#94054) (cherry picked from commit 0ff7b996f5d836e63cdaf652c7aa734285261096) * Run Tools/scripts/reindent.py (#94225) Reindent files which were not properly formatted (PEP 8: 4 spaces). Remove also some trailing spaces. (cherry picked from commit e87ada48a9e5d9d03f9759138869216df0d7383a) * gh-94026: Buffer regrtest worker stdout in temporary file (GH-94253) Co-authored-by: Victor Stinner <vstinner@python.org> (cherry picked from commit 199ba233248ab279f445e0809c2077976f0711bc) * gh-96465: Clear fractions hash lru_cache under refleak testing (GH-96689) Automerge-Triggered-By: GH:zware (cherry picked from commit 9c8f3794337457b1d905a9fa0f38c2978fe32abd) * gh-95027: Fix regrtest stdout encoding on Windows (#98492) On Windows, when the Python test suite is run with the -jN option, the ANSI code page is now used as the encoding for the stdout temporary file, rather than using UTF-8 which can lead to decoding errors. (cherry picked from commit ec1f6f5f139868dc2c1116a7c7c878c38c668d53) * gh-98903: Test suite fails with exit code 4 if no tests ran (#98904) The Python test suite now fails wit exit code 4 if no tests ran. It should help detecting typos in test names and test methods. * Add "EXITCODE_" constants to Lib/test/libregrtest/main.py. * Fix a typo: "NO TEST RUN" becomes "NO TESTS RAN" (cherry picked from commit c76db37c0d23174cbffd6fa978d39693890ef020) * gh-100086: Add build info to test.libregrtest (#100093) The Python test runner (libregrtest) now logs Python build information like "debug" vs "release" build, or LTO and PGO optimizations. (cherry picked from commit 3c892022472eb975360fb3f0caa6f6fcc6fbf220) * bpo-46523: fix tests rerun when `setUp[Class|Module]` fails (#30895) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit 995386071f96e4cfebfa027a71ca9134e4651d2a) * gh-82054: allow test runner to split test_asyncio to execute in parallel by sharding. (#103927) This runs test_asyncio sub-tests in parallel using sharding from Cinder. This suite is typically the longest-pole in runs because it is a test package with a lot of further sub-tests otherwise run serially. By breaking out the sub-tests as independent modules we can run a lot more in parallel. After porting we can see the direct impact on a multicore system. Without this change: Running make test is 5 min 26 seconds With this change: Running make test takes 3 min 39 seconds That'll vary based on system and parallelism. On a `-j 4` run similar to what CI and buildbot systems often do, it reduced the overall test suite completion latency by 10%. The drawbacks are that this implementation is hacky and due to the sorting of the tests it obscures when the asyncio tests occur and involves changing CPython test infrastructure but, the wall time saved it is worth it, especially in low-core count CI runs as it pulls a long tail. The win for productivity and reserved CI resource usage is significant. Future tests that deserve to be refactored into split up suites to benefit from are test_concurrent_futures and the way the _test_multiprocessing suite gets run for all start methods. As exposed by passing the -o flag to python -m test to get a list of the 10 longest running tests. --------- Co-authored-by: Carl Meyer <carl@oddbird.net> Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google, LLC] (cherry picked from commit 9e011e7c77dad7d0bbb944c44891531606caeb21) * Display the sanitizer config in the regrtest header. (#105301) Display the sanitizers present in libregrtest. Having this in the CI output for tests with the relevant environment variable displayed will help make it easier to do what we need to create an equivalent local test run. (cherry picked from commit 852348ab65783601e0844b6647ea033668b45c11) * gh-101634: regrtest reports decoding error as failed test (#106169) When running the Python test suite with -jN option, if a worker stdout cannot be decoded from the locale encoding report a failed testn so the exitcode is non-zero. (cherry picked from commit 2ac3eec103cf450aaaebeb932e51155d2e7fb37b) * gh-108223: test.pythoninfo and libregrtest log Py_NOGIL (#108238) Enable with --disable-gil --without-pydebug: $ make pythoninfo|grep NOGIL sysconfig[Py_NOGIL]: 1 $ ./python -m test ... == Python build: nogil debug ... (cherry picked from commit 5afe0c17ca14df430736e549542a4b85e7e7c7ac) * gh-90791: test.pythoninfo logs ASAN_OPTIONS env var (#108289) * Cleanup libregrtest code logging ASAN_OPTIONS. * Fix a typo on "ASAN_OPTIONS" vs "MSAN_OPTIONS". (cherry picked from commit 3a1ac87f8f89d3206b46a0df4908afae629d669d) * gh-108388: regrtest splits test_asyncio package (#108393) Currently, test_asyncio package is only splitted into sub-tests when using command "./python -m test". With this change, it's also splitted when passing it on the command line: "./python -m test test_asyncio". Remove the concept of "STDTESTS". Python is now mature enough to not have to bother with that anymore. Removing STDTESTS simplify the code. (cherry picked from commit 174e9da0836844a2138cc8915dd305cb2cd7a583) * regrtest computes statistics (#108793) test_netrc, test_pep646_syntax and test_xml_etree now return results in the test_main() function. Changes: * Rewrite TestResult as a dataclass with a new State class. * Add test.support.TestStats class and Regrtest.stats_dict attribute. * libregrtest.runtest functions now modify a TestResult instance in-place. * libregrtest summary lists the number of run tests and skipped tests, and denied resources. * Add TestResult.has_meaningful_duration() method. * Compute TestResult duration in the upper function. * Use time.perf_counter() instead of time.monotonic(). * Regrtest: rename 'resource_denieds' attribute to 'resource_denied'. * Rename CHILD_ERROR to MULTIPROCESSING_ERROR. * Use match/case syntadx to have different code depending on the test state. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> (cherry picked from commit d4e534cbb35678c82b3a1276826af55d7bfc23b6) * gh-108822: Add Changelog entry for regrtest statistics (#108821) --------- Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: Zachary Ware <zach@python.org> Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Co-authored-by: Joshua Herman <zitterbewegung@gmail.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-90473: Make chmod a dummy on WASI, skip chmod tests (GH-93534) (GH-93550)Miss Islington (bot)2022-06-061-0/+1
| | | | | | WASI does not have the ``chmod(2)`` syscall yet. (cherry picked from commit 22fed605e096eb74f3aa33f6d25aee76fdc2a3fa) Co-authored-by: Christian Heimes <christian@python.org>
* gh-90473: Misc test fixes for WASI (GH-93218)Miss Islington (bot)2022-05-251-0/+6
| | | | | | | | | | | * ``sys.executable`` is not set * WASI does not support subprocess * ``pwd`` module is not available * WASI checks ``open`` syscall flags more strict, needs r, w, rw flag. * ``umask`` is not available * ``/dev/null`` may not be accessible (cherry picked from commit 1f134e96ba994bea3aaea533d4a558df3c5cc3c0) Co-authored-by: Christian Heimes <christian@python.org>
* gh-91915: Fix test_netrc on non-UTF-8 locale (GH-91918)Serhiy Storchaka2022-04-261-1/+1
|
* bpo-28806: Continue work: improve the netrc library (GH-26330)Emmanuel Arias2021-11-171-81/+224
| | | | | | | | | Continue with the improvement of the library netrc Original work and report Xiang Zhang <angwerzx@126.com> * 📜🤖 Added by blurb_it. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-31904: Fix test_netrc for VxWorks RTOS (GH-21675)pxinwr2020-12-011-48/+42
| | | Fix test_netrc on VxWorks: create temporary directories using temp_cwd().
* bpo-40275: Use new test.support helper submodules in tests (GH-21314)Hai Shi2020-07-061-9/+10
|
* bpo-36264: Don't honor POSIX HOME in os.path.expanduser on Windows (GH-12282)Anthony Sottile2019-03-121-0/+1
|
* bpo-35202: Remove unused imports in tests. (GH-10561)Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి)2018-11-161-1/+0
|
* bpo-28334: netrc() now uses expanduser() to find .netrc file (GH-4537)Berker Peksag2017-11-251-3/+40
| | | | | Previously, netrc.netrc() was raised an exception if $HOME is not set. Authored-By: Dimitri Merejkowsky <dimitri.merejkowsky@tanker.io>
* bpo-30806 netrc.__repr__() is broken for writing to file (GH-2491)James Sexton2017-09-301-3/+6
| | | | | netrc file format doesn't support quotes and escapes. See https://linux.die.net/man/5/netrc
* #14984: On POSIX, enforce permissions when reading default .netrc.R David Murray2013-09-181-3/+23
| | | | | | | | Initial patch by Bruno Piguet. This is implemented as if a useful .netrc file could exist without passwords, which is possible in the general case; but in fact our netrc implementation does not support it. Fixing that issue will be an enhancement.
* fix regression in netrc comment handling (closes #12009)Benjamin Peterson2011-06-101-39/+92
|
* Merged revisions 86925 via svnmerge fromR. David Murray2010-12-021-6/+16
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86925 | r.david.murray | 2010-12-01 21:58:07 -0500 (Wed, 01 Dec 2010) | 4 lines #10464: fix netrc handling of lines with embedded '#" characters. Patch by Xuanji Li. ........
* Merged revisions 73715 via svnmerge fromGeorg Brandl2009-08-131-3/+3
| | | | | | | | | | svn+ssh://svn.python.org/python/branches/py3k ........ r73715 | benjamin.peterson | 2009-07-01 01:06:06 +0200 (Mi, 01 Jul 2009) | 1 line convert old fail* assertions to assert* ........
* #2621 rename test.test_support to test.supportBenjamin Peterson2008-05-201-3/+3
|
* Patch # 1331 by Christian Heimes.Guido van Rossum2007-10-261-7/+6
| | | | | The patch fixes some of the problems on Windows. It doesn't introduce addition problems on Linux.
* Unconditionally opening the temp file in text mode causes this test to failJason Tishler2003-08-111-2/+5
| | | | | | under Cygwin. The attached patch corrects this problem. I tested this patch under Red Hat Linux 8.0 too.
* Actually run these tests from regrtest.py.Neal Norwitz2003-02-171-1/+3
| | | | | | There was no test_main() and the main body was protected by if __name__ == '__main__' so the test didn't happen on import either.
* Massive changes from SF 589982 (tempfile.py rewrite, by ZackGuido van Rossum2002-08-091-2/+2
| | | | | Weinberg). This changes all uses of deprecated tempfile functions to the recommended ones.
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+2
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* Whitespace normalization.Tim Peters2002-04-161-5/+4
|
* Add a simple test suite for netrc.py, and remove it from test_sundryAndrew M. Kuchling2002-03-221-0/+43