Commit Graph

3 Commits

Author SHA1 Message Date
Miss Islington (bot) c2735b75af
bpo-46678: Fix Invalid cross device link in Lib/test/support/import_helper.py (GH-31204) (GH-31207)
In `Lib/test/support/import_helper.py`, the function `make_legacy_pyc` makes a call to `os.rename` which can fail when the source and target live on different devices. This happens (for example) when `PYTHONPYCACHEPREFIX` is set to a directory anywhere on disk, while a ramdisk is mounted on `/tmp` (the latter of which is the default on various Linux distros). Replacing `os.rename` with `shutil.move` fixes this.

Automerge-Triggered-By: GH:brettcannon
(cherry picked from commit da576e0829)

Co-authored-by: Jason Wilkes <notarealdeveloper@gmail.com>
2022-02-08 13:04:05 -08:00
Serhiy Storchaka 7873884d47
[3.10] bpo-40173: Fix test.support.import_helper.import_fresh_module() (GH-28654) (GH-28657)
* Work correctly if an additional fresh module imports other
  additional fresh module which imports a blocked module.
* Raises ImportError if the specified module cannot be imported
  while all additional fresh modules are successfully imported.
* Support blocking packages.
* Always restore the import state of fresh and blocked modules
  and their submodules.
* Fix test_decimal and test_xml_etree which depended on an undesired
  side effect of import_fresh_module().
(cherry picked from commit ec4d917a6a)
2021-09-30 19:56:41 +03:00
Hai Shi 7f888c7ef9
bpo-40275: Add import_helper submodule in test.support (GH-20794) 2020-06-11 01:51:18 +02:00