(self)
| 1433 | |
| 1434 | @unittest.expectedFailure # TODO: RUSTPYTHON |
| 1435 | def test_write_pyfile(self): |
| 1436 | self.requiresWriteAccess(os.path.dirname(__file__)) |
| 1437 | with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp: |
| 1438 | fn = __file__ |
| 1439 | if fn.endswith('.pyc'): |
| 1440 | path_split = fn.split(os.sep) |
| 1441 | if os.altsep is not None: |
| 1442 | path_split.extend(fn.split(os.altsep)) |
| 1443 | if '__pycache__' in path_split: |
| 1444 | fn = importlib.util.source_from_cache(fn) |
| 1445 | else: |
| 1446 | fn = fn[:-1] |
| 1447 | |
| 1448 | zipfp.writepy(fn) |
| 1449 | |
| 1450 | bn = os.path.basename(fn) |
| 1451 | self.assertNotIn(bn, zipfp.namelist()) |
| 1452 | self.assertCompiledIn(bn, zipfp.namelist()) |
| 1453 | |
| 1454 | with TemporaryFile() as t, zipfile.PyZipFile(t, "w") as zipfp: |
| 1455 | fn = __file__ |
| 1456 | if fn.endswith('.pyc'): |
| 1457 | fn = fn[:-1] |
| 1458 | |
| 1459 | zipfp.writepy(fn, "testpackage") |
| 1460 | |
| 1461 | bn = "%s/%s" % ("testpackage", os.path.basename(fn)) |
| 1462 | self.assertNotIn(bn, zipfp.namelist()) |
| 1463 | self.assertCompiledIn(bn, zipfp.namelist()) |
| 1464 | |
| 1465 | @unittest.expectedFailure # TODO: RUSTPYTHON |
| 1466 | def test_write_python_package(self): |
nothing calls this directly
no test coverage detected