diff options
author | Steve Dower <steve.dower@microsoft.com> | 2016-09-17 21:35:32 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2016-09-17 21:35:32 (GMT) |
commit | 6dd8eca4a95f60b8ed8517ad2f8f48405907f56c (patch) | |
tree | 4df11ba9a6a47973cbb7ebf67ef29a703de4daea | |
parent | 27f26ad962b08ed77df514d529dddbd36b58a3f3 (diff) | |
download | cpython-6dd8eca4a95f60b8ed8517ad2f8f48405907f56c.zip cpython-6dd8eca4a95f60b8ed8517ad2f8f48405907f56c.tar.gz cpython-6dd8eca4a95f60b8ed8517ad2f8f48405907f56c.tar.bz2 |
Issue #28192: Adds tests for hook in isolated mode
-rw-r--r-- | Lib/test/test_site.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index b048648..d2fbb7b 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -471,5 +471,23 @@ class StartupImportTests(unittest.TestCase): if sys.platform != 'darwin': self.assertFalse(modules.intersection(collection_mods), stderr) + def test_startup_interactivehook(self): + r = subprocess.Popen([sys.executable, '-c', + 'import sys; sys.exit(hasattr(sys, "__interactivehook__"))']).wait() + self.assertTrue(r, "'__interactivehook__' not added by site") + + def test_startup_interactivehook_isolated(self): + # issue28192 readline is not automatically enabled in isolated mode + r = subprocess.Popen([sys.executable, '-I', '-c', + 'import sys; sys.exit(hasattr(sys, "__interactivehook__"))']).wait() + self.assertFalse(r, "'__interactivehook__' added in isolated mode") + + def test_startup_interactivehook_isolated_explicit(self): + # issue28192 readline can be explicitly enabled in isolated mode + r = subprocess.Popen([sys.executable, '-I', '-c', + 'import site, sys; site.enablerlcompleter(); sys.exit(hasattr(sys, "__interactivehook__"))']).wait() + self.assertTrue(r, "'__interactivehook__' not added by enablerlcompleter()") + + if __name__ == "__main__": unittest.main() |