(self)
| 367 | ) |
| 368 | |
| 369 | def test_strip_only_invalid(self): |
| 370 | fullpath = ["test", "build", "real", "path"] |
| 371 | path = os.path.join(self.directory, *fullpath) |
| 372 | os.makedirs(path) |
| 373 | script = script_helper.make_script(path, "test", "1 / 0") |
| 374 | bc = importlib.util.cache_from_source(script) |
| 375 | stripdir = os.path.join(self.directory, *(fullpath[:2] + ['fake'])) |
| 376 | with support.captured_stdout() as out: |
| 377 | compileall.compile_dir(path, quiet=True, stripdir=stripdir) |
| 378 | self.assertIn("not a valid prefix", out.getvalue()) |
| 379 | rc, out, err = script_helper.assert_python_failure(bc) |
| 380 | expected_not_in = os.path.join(self.directory, *fullpath[2:]) |
| 381 | self.assertIn( |
| 382 | path, |
| 383 | str(err, encoding=sys.getdefaultencoding()) |
| 384 | ) |
| 385 | self.assertNotIn( |
| 386 | expected_not_in, |
| 387 | str(err, encoding=sys.getdefaultencoding()) |
| 388 | ) |
| 389 | self.assertNotIn( |
| 390 | stripdir, |
| 391 | str(err, encoding=sys.getdefaultencoding()) |
| 392 | ) |
| 393 | |
| 394 | def test_prepend_only(self): |
| 395 | fullpath = ["test", "build", "real", "path"] |
nothing calls this directly
no test coverage detected