summaryrefslogtreecommitdiff
path: root/buildscripts/tests
diff options
context:
space:
mode:
authorSiran Wang <siran.wang@mongodb.com>2021-06-02 20:02:05 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-06-08 16:43:14 +0000
commit6489baf485d4fc5ee60ea48f6a145b9516435afa (patch)
treed56924993f7be2fe96a25c2c7d5ec6cea5c331f0 /buildscripts/tests
parent593de38d3391c523e1848f8dc0040c02387b0735 (diff)
downloadmongo-6489baf485d4fc5ee60ea48f6a145b9516435afa.tar.gz
SERVER-55147 resmoke should shlex.quote() commands before printing them
Diffstat (limited to 'buildscripts/tests')
-rw-r--r--buildscripts/tests/resmokelib/testing/testcases/test_pytest.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/buildscripts/tests/resmokelib/testing/testcases/test_pytest.py b/buildscripts/tests/resmokelib/testing/testcases/test_pytest.py
index 6d349564abb..4b218c41a77 100644
--- a/buildscripts/tests/resmokelib/testing/testcases/test_pytest.py
+++ b/buildscripts/tests/resmokelib/testing/testcases/test_pytest.py
@@ -24,7 +24,7 @@ class TestPyTestCase(unittest.TestCase):
self.assertEqual(pytest_case.test_name, filename)
self.assertEqual(pytest_case.logger, logger)
proc = pytest_case._make_process()
- self.assertIn(sys.executable + " -m unittest", proc.as_command())
+ self.assertIn(" -m unittest", proc.as_command())
self.assertIn(pytest_case.test_module_name, proc.as_command())
self.assertEqual(proc.logger, logger)
@@ -35,7 +35,7 @@ class TestPyTestCase(unittest.TestCase):
self.assertEqual(pytest_case.test_name, filename)
self.assertEqual(pytest_case.logger, logger)
proc = pytest_case._make_process()
- self.assertIn(sys.executable + " -m unittest", proc.as_command())
+ self.assertIn(" -m unittest", proc.as_command())
self.assertIn(pytest_case.test_module_name, proc.as_command())
self.assertEqual(proc.logger, logger)
@@ -46,7 +46,7 @@ class TestPyTestCase(unittest.TestCase):
self.assertEqual(pytest_case.test_name, filename)
self.assertEqual(pytest_case.logger, logger)
proc = pytest_case._make_process()
- self.assertIn(sys.executable + " -m unittest", proc.as_command())
+ self.assertIn(" -m unittest", proc.as_command())
self.assertIn(pytest_case.test_module_name, proc.as_command())
self.assertEqual(proc.logger, logger)
@@ -67,3 +67,14 @@ class TestPyTestCase(unittest.TestCase):
filename = "myfile.py"
pytest_case = pytest.PyTestCase(logger, filename)
self.assertEqual(pytest_case.test_module_name, "myfile")
+
+ def test__make_process_with_space(self):
+ logger = logging.getLogger("pytest")
+ filename = "this file name has space.py:q:"
+ pytest_case = pytest.PyTestCase(logger, filename)
+ self.assertEqual(pytest_case.test_name, filename)
+ self.assertEqual(pytest_case.logger, logger)
+ proc = pytest_case._make_process()
+ self.assertIn(" -m unittest", proc.as_command())
+ self.assertIn(pytest_case.test_module_name, proc.as_command())
+ self.assertEqual(proc.logger, logger)