summaryrefslogtreecommitdiff
path: root/Lib/test/test_venv.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_venv.py')
-rw-r--r--Lib/test/test_venv.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py
index de93d9539c..0103de8828 100644
--- a/Lib/test/test_venv.py
+++ b/Lib/test/test_venv.py
@@ -9,6 +9,7 @@ import ensurepip
import os
import os.path
import re
+import shutil
import struct
import subprocess
import sys
@@ -360,6 +361,25 @@ class BasicTest(BaseTest):
'pool.terminate()'])
self.assertEqual(out.strip(), "python".encode())
+ @unittest.skipIf(os.name == 'nt', 'not relevant on Windows')
+ def test_deactivate_with_strict_bash_opts(self):
+ bash = shutil.which("bash")
+ if bash is None:
+ self.skipTest("bash required for this test")
+ rmtree(self.env_dir)
+ builder = venv.EnvBuilder(clear=True)
+ builder.create(self.env_dir)
+ activate = os.path.join(self.env_dir, self.bindir, "activate")
+ test_script = os.path.join(self.env_dir, "test_strict.sh")
+ with open(test_script, "w") as f:
+ f.write("set -euo pipefail\n"
+ f"source {activate}\n"
+ "deactivate\n")
+ out, err = check_output([bash, test_script])
+ self.assertEqual(out, "".encode())
+ self.assertEqual(err, "".encode())
+
+
@requireVenvCreate
class EnsurePipTest(BaseTest):
"""Test venv module installation of pip."""