Bug 1435820 - Rename mozprocess unit tests and support files. draft
authorHenrik Skupin <mail@hskupin.info>
Mon, 05 Feb 2018 21:50:57 +0100
changeset 751482 f292528c31be1f200f72308065436b73cb66b214
parent 751480 ccbc56e685c94256a2fc6b4e9ab3c20a494edcbb
push id97977
push userbmo:hskupin@gmail.com
push dateTue, 06 Feb 2018 11:47:32 +0000
bugs1435820
milestone60.0a1
Bug 1435820 - Rename mozprocess unit tests and support files. MozReview-Commit-ID: 2LhfafKi8ym
testing/mozbase/mozprocess/tests/infinite_loop.py
testing/mozbase/mozprocess/tests/manifest.ini
testing/mozbase/mozprocess/tests/proccountfive.py
testing/mozbase/mozprocess/tests/process_normal_broad.ini
testing/mozbase/mozprocess/tests/process_normal_broad_python.ini
testing/mozbase/mozprocess/tests/process_normal_deep.ini
testing/mozbase/mozprocess/tests/process_normal_deep_python.ini
testing/mozbase/mozprocess/tests/process_normal_finish.ini
testing/mozbase/mozprocess/tests/process_normal_finish_python.ini
testing/mozbase/mozprocess/tests/process_waittimeout.ini
testing/mozbase/mozprocess/tests/process_waittimeout_10s.ini
testing/mozbase/mozprocess/tests/process_waittimeout_10s_python.ini
testing/mozbase/mozprocess/tests/process_waittimeout_python.ini
testing/mozbase/mozprocess/tests/procnonewline.py
testing/mozbase/mozprocess/tests/scripts/infinite_loop.py
testing/mozbase/mozprocess/tests/scripts/proccountfive.py
testing/mozbase/mozprocess/tests/scripts/procnonewline.py
testing/mozbase/mozprocess/tests/test_kill.py
testing/mozbase/mozprocess/tests/test_misc.py
testing/mozbase/mozprocess/tests/test_mozprocess_kill.py
testing/mozbase/mozprocess/tests/test_mozprocess_misc.py
testing/mozbase/mozprocess/tests/test_mozprocess_output.py
testing/mozbase/mozprocess/tests/test_mozprocess_params.py
testing/mozbase/mozprocess/tests/test_mozprocess_poll.py
testing/mozbase/mozprocess/tests/test_mozprocess_wait.py
testing/mozbase/mozprocess/tests/test_output.py
testing/mozbase/mozprocess/tests/test_params.py
testing/mozbase/mozprocess/tests/test_poll.py
testing/mozbase/mozprocess/tests/test_wait.py
--- a/testing/mozbase/mozprocess/tests/manifest.ini
+++ b/testing/mozbase/mozprocess/tests/manifest.ini
@@ -1,15 +1,15 @@
 # does not currently work on windows
 # see https://bugzilla.mozilla.org/show_bug.cgi?id=790765#c51
 
 [DEFAULT]
 # bug https://bugzilla.mozilla.org/show_bug.cgi?id=778267#c26
 skip-if = (os == "win")
 subsuite = mozbase, os == "linux"
 
-[test_mozprocess_kill.py]
-[test_mozprocess_misc.py]
-[test_mozprocess_poll.py]
-[test_mozprocess_wait.py]
-[test_mozprocess_output.py]
-[test_mozprocess_params.py]
+[test_kill.py]
+[test_misc.py]
+[test_poll.py]
+[test_wait.py]
+[test_output.py]
+[test_params.py]
 [test_process_reader.py]
rename from testing/mozbase/mozprocess/tests/process_normal_broad_python.ini
rename to testing/mozbase/mozprocess/tests/process_normal_broad.ini
rename from testing/mozbase/mozprocess/tests/process_normal_deep_python.ini
rename to testing/mozbase/mozprocess/tests/process_normal_deep.ini
rename from testing/mozbase/mozprocess/tests/process_normal_finish_python.ini
rename to testing/mozbase/mozprocess/tests/process_normal_finish.ini
rename from testing/mozbase/mozprocess/tests/process_waittimeout_python.ini
rename to testing/mozbase/mozprocess/tests/process_waittimeout.ini
rename from testing/mozbase/mozprocess/tests/process_waittimeout_10s_python.ini
rename to testing/mozbase/mozprocess/tests/process_waittimeout_10s.ini
rename from testing/mozbase/mozprocess/tests/infinite_loop.py
rename to testing/mozbase/mozprocess/tests/scripts/infinite_loop.py
rename from testing/mozbase/mozprocess/tests/proccountfive.py
rename to testing/mozbase/mozprocess/tests/scripts/proccountfive.py
rename from testing/mozbase/mozprocess/tests/procnonewline.py
rename to testing/mozbase/mozprocess/tests/scripts/procnonewline.py
rename from testing/mozbase/mozprocess/tests/test_mozprocess_kill.py
rename to testing/mozbase/mozprocess/tests/test_kill.py
--- a/testing/mozbase/mozprocess/tests/test_mozprocess_kill.py
+++ b/testing/mozbase/mozprocess/tests/test_kill.py
@@ -23,86 +23,86 @@ class ProcTestKill(proctest.ProcTest):
 
         p = processhandler.ProcessHandler([self.python, '-V'])
         self.assertRaises(RuntimeError, p.kill)
 
     def test_process_kill(self):
         """Process is started, we kill it"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_finish_python.ini"],
+                                           "process_normal_finish.ini"],
                                           cwd=here)
         p.run()
         p.kill()
 
         self.determine_status(p, expectedfail=('returncode',))
 
     def test_process_kill_deep(self):
         """Process is started, we kill it, we use a deep process tree"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_deep_python.ini"],
+                                           "process_normal_deep.ini"],
                                           cwd=here)
         p.run()
         p.kill()
 
         self.determine_status(p, expectedfail=('returncode',))
 
     def test_process_kill_deep_wait(self):
         """Process is started, we use a deep process tree, we let it spawn
            for a bit, we kill it"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_deep_python.ini"],
+                                           "process_normal_deep.ini"],
                                           cwd=here)
         p.run()
         # Let the tree spawn a bit, before attempting to kill
         time.sleep(3)
         p.kill()
 
         self.determine_status(p, expectedfail=('returncode',))
 
     def test_process_kill_broad(self):
         """Process is started, we kill it, we use a broad process tree"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_broad_python.ini"],
+                                           "process_normal_broad.ini"],
                                           cwd=here)
         p.run()
         p.kill()
 
         self.determine_status(p, expectedfail=('returncode',))
 
     def test_process_kill_broad_delayed(self):
         """Process is started, we use a broad process tree, we let it spawn
            for a bit, we kill it"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_broad_python.ini"],
+                                           "process_normal_broad.ini"],
                                           cwd=here)
         p.run()
         # Let the tree spawn a bit, before attempting to kill
         time.sleep(3)
         p.kill()
 
         self.determine_status(p, expectedfail=('returncode',))
 
     @unittest.skipUnless(processhandler.isPosix, "posix only")
     def test_process_kill_with_sigterm(self):
-        script = os.path.join(here, 'infinite_loop.py')
+        script = os.path.join(here, 'scripts', 'infinite_loop.py')
         p = processhandler.ProcessHandler([self.python, script])
 
         p.run()
         p.kill()
 
         self.assertEquals(p.proc.returncode, -signal.SIGTERM)
 
     @unittest.skipUnless(processhandler.isPosix, "posix only")
     def test_process_kill_with_sigint_if_needed(self):
-        script = os.path.join(here, 'infinite_loop.py')
+        script = os.path.join(here, 'scripts', 'infinite_loop.py')
         p = processhandler.ProcessHandler([self.python, script, 'deadlock'])
 
         p.run()
         time.sleep(1)
         p.kill()
 
         self.assertEquals(p.proc.returncode, -signal.SIGKILL)
 
rename from testing/mozbase/mozprocess/tests/test_mozprocess_misc.py
rename to testing/mozbase/mozprocess/tests/test_misc.py
--- a/testing/mozbase/mozprocess/tests/test_mozprocess_misc.py
+++ b/testing/mozbase/mozprocess/tests/test_misc.py
@@ -21,32 +21,32 @@ class ProcTestMisc(proctest.ProcTest):
             to complete. Process should not be killed.
         """
         p = None
 
         def timeout_handler():
             self.assertEqual(p.proc.poll(), None)
             p.kill()
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_waittimeout_python.ini"],
+                                           "process_waittimeout.ini"],
                                           cwd=here,
                                           onTimeout=(timeout_handler,),
                                           kill_on_timeout=False)
         p.run(timeout=1)
         p.wait()
         self.assertTrue(p.didTimeout)
 
         self.determine_status(p, False, ['returncode', 'didtimeout'])
 
     def test_unicode_in_environment(self):
         env = {
             'FOOBAR': 'ʘ',
         }
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_finish_python.ini"],
+                                           "process_normal_finish.ini"],
                                           cwd=here, env=env)
         # passes if no exceptions are raised
         p.run()
         p.wait()
 
 
 if __name__ == '__main__':
     mozunit.main()
rename from testing/mozbase/mozprocess/tests/test_mozprocess_output.py
rename to testing/mozbase/mozprocess/tests/test_output.py
--- a/testing/mozbase/mozprocess/tests/test_mozprocess_output.py
+++ b/testing/mozbase/mozprocess/tests/test_output.py
@@ -16,30 +16,30 @@ here = os.path.dirname(os.path.abspath(_
 class ProcTestOutput(proctest.ProcTest):
     """ Class to test operations related to output handling """
 
     def test_process_output_twice(self):
         """
         Process is started, then processOutput is called a second time explicitly
         """
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_waittimeout_10s_python.ini"],
+                                           "process_waittimeout_10s.ini"],
                                           cwd=here)
 
         p.run()
         p.processOutput(timeout=5)
         p.wait()
 
         self.determine_status(p, False, ())
 
     def test_process_output_nonewline(self):
         """
         Process is started, outputs data with no newline
         """
-        p = processhandler.ProcessHandler([self.python, "procnonewline.py"],
+        p = processhandler.ProcessHandler([self.python, "scripts", "procnonewline.py"],
                                           cwd=here)
 
         p.run()
         p.processOutput(timeout=5)
         p.wait()
 
         self.determine_status(p, False, ())
 
@@ -47,17 +47,18 @@ class ProcTestOutput(proctest.ProcTest):
         """
         Process output stream does not buffer
         """
         expected = '\n'.join([str(n) for n in range(0, 10)])
 
         stream = io.BytesIO()
         buf = io.BufferedRandom(stream)
 
-        p = processhandler.ProcessHandler([self.python, "proccountfive.py"],
+        p = processhandler.ProcessHandler([self.python,
+                                           os.path.join("scripts", "proccountfive.py")],
                                           cwd=here,
                                           stream=buf)
 
         p.run()
         p.wait()
         for i in range(5, 10):
             stream.write(str(i) + '\n')
 
rename from testing/mozbase/mozprocess/tests/test_mozprocess_params.py
rename to testing/mozbase/mozprocess/tests/test_params.py
rename from testing/mozbase/mozprocess/tests/test_mozprocess_poll.py
rename to testing/mozbase/mozprocess/tests/test_poll.py
--- a/testing/mozbase/mozprocess/tests/test_mozprocess_poll.py
+++ b/testing/mozbase/mozprocess/tests/test_poll.py
@@ -17,39 +17,39 @@ here = os.path.dirname(os.path.abspath(_
 
 class ProcTestPoll(proctest.ProcTest):
     """ Class to test process poll """
 
     def test_poll_before_run(self):
         """Process is not started, and poll() is called"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_finish_python.ini"],
+                                           "process_normal_finish.ini"],
                                           cwd=here)
         self.assertRaises(RuntimeError, p.poll)
 
     def test_poll_while_running(self):
         """Process is started, and poll() is called"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_finish_python.ini"],
+                                           "process_normal_finish.ini"],
                                           cwd=here)
         p.run()
         returncode = p.poll()
 
         self.assertEqual(returncode, None)
 
         self.determine_status(p, True)
         p.kill()
 
     def test_poll_after_kill(self):
         """Process is killed, and poll() is called"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_finish_python.ini"],
+                                           "process_normal_finish.ini"],
                                           cwd=here)
         p.run()
         returncode = p.kill()
 
         # We killed the process, so the returncode should be < 0
         self.assertLess(returncode, 0)
         self.assertEqual(returncode, p.poll())
 
@@ -71,33 +71,33 @@ class ProcTestPoll(proctest.ProcTest):
         self.assertEqual(returncode, p.poll())
 
         self.determine_status(p)
 
     def test_poll_after_double_kill(self):
         """Process is killed twice, and poll() is called"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_finish_python.ini"],
+                                           "process_normal_finish.ini"],
                                           cwd=here)
         p.run()
         p.kill()
         returncode = p.kill()
 
         # We killed the process, so the returncode should be < 0
         self.assertLess(returncode, 0)
         self.assertEqual(returncode, p.poll())
 
         self.determine_status(p)
 
     def test_poll_after_external_kill(self):
         """Process is killed externally, and poll() is called"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_finish_python.ini"],
+                                           "process_normal_finish.ini"],
                                           cwd=here)
         p.run()
         os.kill(p.pid, signal.SIGTERM)
         returncode = p.wait()
 
         # We killed the process, so the returncode should be < 0
         self.assertEqual(returncode, -signal.SIGTERM)
         self.assertEqual(returncode, p.poll())
rename from testing/mozbase/mozprocess/tests/test_mozprocess_wait.py
rename to testing/mozbase/mozprocess/tests/test_wait.py
--- a/testing/mozbase/mozprocess/tests/test_mozprocess_wait.py
+++ b/testing/mozbase/mozprocess/tests/test_wait.py
@@ -15,79 +15,79 @@ here = os.path.dirname(os.path.abspath(_
 
 class ProcTestWait(proctest.ProcTest):
     """ Class to test process waits and timeouts """
 
     def test_normal_finish(self):
         """Process is started, runs to completion while we wait for it"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_normal_finish_python.ini"],
+                                           "process_normal_finish.ini"],
                                           cwd=here)
         p.run()
         p.wait()
 
         self.determine_status(p)
 
     def test_wait(self):
         """Process is started runs to completion while we wait indefinitely"""
 
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_waittimeout_10s_python.ini"],
+                                           "process_waittimeout_10s.ini"],
                                           cwd=here)
         p.run()
         p.wait()
 
         self.determine_status(p)
 
     def test_timeout(self):
         """ Process is started, runs but we time out waiting on it
             to complete
         """
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_waittimeout_python.ini"],
+                                           "process_waittimeout.ini"],
                                           cwd=here)
         p.run(timeout=10)
         p.wait()
 
         if mozinfo.isUnix:
             # process was killed, so returncode should be negative
             self.assertLess(p.proc.returncode, 0)
 
         self.determine_status(p, False, ['returncode', 'didtimeout'])
 
     def test_waittimeout(self):
         """
         Process is started, then wait is called and times out.
         Process is still running and didn't timeout
         """
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_waittimeout_10s_python.ini"],
+                                           "process_waittimeout_10s.ini"],
                                           cwd=here)
 
         p.run()
         p.wait(timeout=0)
 
         self.determine_status(p, True, ())
 
     def test_waitnotimeout(self):
         """ Process is started, runs to completion before our wait times out
         """
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_waittimeout_10s_python.ini"],
+                                           "process_waittimeout_10s.ini"],
                                           cwd=here)
         p.run(timeout=30)
         p.wait()
 
         self.determine_status(p)
 
     def test_wait_twice_after_kill(self):
         """Bug 968718: Process is started and stopped. wait() twice afterward."""
         p = processhandler.ProcessHandler([self.python, self.proclaunch,
-                                           "process_waittimeout_python.ini"],
+                                           "process_waittimeout.ini"],
                                           cwd=here)
         p.run()
         p.kill()
         returncode1 = p.wait()
         returncode2 = p.wait()
 
         self.determine_status(p)