Another attempt at changing pytest ordering so that pytest can run without shell script

This commit is contained in:
Miguel Jacq 2018-10-13 10:03:15 +11:00
parent 540806f0aa
commit 1043be4483
No known key found for this signature in database
GPG key ID: EEA4341C6D97A0B6
19 changed files with 28 additions and 53 deletions

View file

@ -20,4 +20,4 @@ before_script:
# run CLI tests and local GUI tests # run CLI tests and local GUI tests
script: script:
- pytest --cov=onionshare tests/ - pytest --cov=onionshare tests/
- cd tests_gui && xvfb-run ./run_unit_tests.sh - xvfb-run pytest tests_gui/

View file

@ -13,11 +13,10 @@ class LocalReceiveModePublicModeTest(unittest.TestCase, GuiReceiveTest):
} }
cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModePublicModeTest') cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModePublicModeTest')
@pytest.mark.run(order=1)
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
def test_run_all_receive_mode_tests(self): def test_run_all_receive_mode_tests(self):
self.run_all_receive_mode_tests(True, True) self.run_all_receive_mode_tests(True, True)

View file

@ -12,11 +12,10 @@ class LocalReceiveModeTest(unittest.TestCase, GuiReceiveTest):
} }
cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeTest') cls.gui = GuiReceiveTest.set_up(test_settings, 'LocalReceiveModeTest')
@pytest.mark.run(order=1)
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
def test_run_all_receive_mode_tests(self): def test_run_all_receive_mode_tests(self):
self.run_all_receive_mode_tests(False, True) self.run_all_receive_mode_tests(False, True)

View file

@ -12,11 +12,10 @@ class LocalShareModePublicModeTest(unittest.TestCase, GuiShareTest):
} }
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModePublicModeTest') cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModePublicModeTest')
@pytest.mark.run(order=1)
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
def test_run_all_share_mode_tests(self): def test_run_all_share_mode_tests(self):
self.run_all_share_mode_tests(True, False) self.run_all_share_mode_tests(True, False)

View file

@ -12,11 +12,10 @@ class LocalShareModeStayOpenTest(unittest.TestCase, GuiShareTest):
} }
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeStayOpenTest') cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeStayOpenTest')
@pytest.mark.run(order=1)
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
def test_run_all_share_mode_tests(self): def test_run_all_share_mode_tests(self):
self.run_all_share_mode_tests(False, True) self.run_all_share_mode_tests(False, True)

View file

@ -11,11 +11,10 @@ class LocalShareModeTest(unittest.TestCase, GuiShareTest):
} }
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTest') cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTest')
@pytest.mark.run(order=1)
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
def test_run_all_share_mode_tests(self): def test_run_all_share_mode_tests(self):
self.run_all_share_mode_tests(False, False) self.run_all_share_mode_tests(False, False)

View file

@ -15,11 +15,10 @@ class LocalShareModePersistentSlugTest(unittest.TestCase, GuiShareTest):
} }
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModePersistentSlugTest') cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModePersistentSlugTest')
@pytest.mark.run(order=1)
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
def test_run_all_share_mode_tests(self): def test_run_all_share_mode_tests(self):
self.run_all_share_mode_persistent_tests(False, True) self.run_all_share_mode_persistent_tests(False, True)

View file

@ -13,11 +13,10 @@ class LocalShareModeTimerTest(unittest.TestCase, GuiShareTest):
} }
cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTimerTest') cls.gui = GuiShareTest.set_up(test_settings, 'LocalShareModeTimerTest')
@pytest.mark.run(order=1)
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
def test_run_all_share_mode_timer_tests(self): def test_run_all_share_mode_timer_tests(self):
self.run_all_share_mode_timer_tests(False) self.run_all_share_mode_timer_tests(False)

View file

@ -13,34 +13,26 @@ class ShareModeCancelSecondShareTest(unittest.TestCase, TorGuiShareTest):
} }
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeCancelSecondShareTest') cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeCancelSecondShareTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_share_mode_tests(self): def test_run_share_mode_tests(self):
self.run_all_share_mode_tests(False, False) self.run_all_share_mode_tests(False, False)
# Stop the share in order to test canceling the next share @pytest.mark.run(after='test_run_share_mode_tests')
#@pytest.mark.run(order=3)
#@pytest.mark.tor
#def test_stop_share(self):
# self.server_is_stopped(self.gui.share_mode, True)
# self.web_service_is_stopped()
@pytest.mark.run(order=4)
@pytest.mark.tor @pytest.mark.tor
def test_cancel_the_share(self): def test_cancel_the_share(self):
self.cancel_the_share(self.gui.share_mode) self.cancel_the_share(self.gui.share_mode)
@pytest.mark.run(order=5) @pytest.mark.run(after='test_cancel_the_share')
@pytest.mark.tor @pytest.mark.tor
def test_server_is_stopped_round2(self): def test_server_is_stopped_round2(self):
self.server_is_stopped(self.gui.share_mode, False) self.server_is_stopped(self.gui.share_mode, False)
@pytest.mark.run(order=6) @pytest.mark.run(after='test_server_is_stopped_round2')
@pytest.mark.tor @pytest.mark.tor
def test_web_service_is_stopped_round2(self): def test_web_service_is_stopped_round2(self):
self.web_service_is_stopped() self.web_service_is_stopped()

View file

@ -13,12 +13,11 @@ class ReceiveModeTest(unittest.TestCase, TorGuiReceiveTest):
} }
cls.gui = TorGuiReceiveTest.set_up(test_settings, 'ReceiveModeTest') cls.gui = TorGuiReceiveTest.set_up(test_settings, 'ReceiveModeTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_all_receive_mode_tests(self): def test_run_all_receive_mode_tests(self):
self.run_all_receive_mode_tests(True, True) self.run_all_receive_mode_tests(True, True)

View file

@ -12,12 +12,11 @@ class ReceiveModeTest(unittest.TestCase, TorGuiReceiveTest):
} }
cls.gui = TorGuiReceiveTest.set_up(test_settings, 'ReceiveModeTest') cls.gui = TorGuiReceiveTest.set_up(test_settings, 'ReceiveModeTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_all_receive_mode_tests(self): def test_run_all_receive_mode_tests(self):
self.run_all_receive_mode_tests(False, True) self.run_all_receive_mode_tests(False, True)

View file

@ -11,17 +11,16 @@ class ShareModeCancelTest(unittest.TestCase, TorGuiShareTest):
} }
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeCancelTest') cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeCancelTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_share_mode_setup_tests(self): def test_run_share_mode_setup_tests(self):
self.run_all_share_mode_setup_tests() self.run_all_share_mode_setup_tests()
@pytest.mark.run(order=3) @pytest.mark.run(after='test_run_share_mode_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_cancel_the_share(self): def test_cancel_the_share(self):
self.cancel_the_share(self.gui.share_mode) self.cancel_the_share(self.gui.share_mode)

View file

@ -12,12 +12,11 @@ class ShareModePublicModeTest(unittest.TestCase, TorGuiShareTest):
} }
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModePublicModeTest') cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModePublicModeTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_all_share_mode_tests(self): def test_run_all_share_mode_tests(self):
self.run_all_share_mode_tests(True, False) self.run_all_share_mode_tests(True, False)

View file

@ -12,12 +12,11 @@ class ShareModeStayOpenTest(unittest.TestCase, TorGuiShareTest):
} }
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeStayOpenTest') cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeStayOpenTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_all_share_mode_tests(self): def test_run_all_share_mode_tests(self):
self.run_all_share_mode_tests(False, True) self.run_all_share_mode_tests(False, True)

View file

@ -11,12 +11,11 @@ class ShareModeTest(unittest.TestCase, TorGuiShareTest):
} }
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTest') cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_all_share_mode_tests(self): def test_run_all_share_mode_tests(self):
self.run_all_share_mode_tests(False, False) self.run_all_share_mode_tests(False, False)

View file

@ -16,12 +16,11 @@ class LocalShareModePersistentSlugTest(unittest.TestCase, TorGuiShareTest):
} }
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModePersistentSlugTest') cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModePersistentSlugTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_all_share_mode_tests(self): def test_run_all_share_mode_tests(self):
self.run_all_share_mode_persistent_tests(False, True) self.run_all_share_mode_persistent_tests(False, True)

View file

@ -13,23 +13,22 @@ class ShareModeStealthTest(unittest.TestCase, TorGuiShareTest):
} }
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeStealthTest') cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeStealthTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_share_mode_setup_tests(self): def test_run_share_mode_setup_tests(self):
self.run_all_share_mode_setup_tests() self.run_all_share_mode_setup_tests()
self.run_all_share_mode_started_tests(False) self.run_all_share_mode_started_tests(False)
@pytest.mark.run(order=3) @pytest.mark.run(after='test_run_share_mode_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_copy_have_hidserv_auth_button(self): def test_copy_have_hidserv_auth_button(self):
self.copy_have_hidserv_auth_button(self.gui.share_mode) self.copy_have_hidserv_auth_button(self.gui.share_mode)
@pytest.mark.run(order=4) @pytest.mark.run(after='test_run_share_mode_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_hidserv_auth_string(self): def test_hidserv_auth_string(self):
self.hidserv_auth_string() self.hidserv_auth_string()

View file

@ -13,12 +13,11 @@ class ShareModeTimerTest(unittest.TestCase, TorGuiShareTest):
} }
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTimerTest') cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTimerTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_all_share_mode_timer_tests(self): def test_run_all_share_mode_timer_tests(self):
self.run_all_share_mode_timer_tests(False) self.run_all_share_mode_timer_tests(False)

View file

@ -11,28 +11,27 @@ class ShareModeTorConnectionKilledTest(unittest.TestCase, TorGuiShareTest):
} }
cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTorConnectionKilledTest') cls.gui = TorGuiShareTest.set_up(test_settings, 'ShareModeTorConnectionKilledTest')
@pytest.mark.run(order=1)
@pytest.mark.tor @pytest.mark.tor
def test_run_all_common_setup_tests(self): def test_run_all_common_setup_tests(self):
self.run_all_common_setup_tests() self.run_all_common_setup_tests()
@pytest.mark.run(order=2) @pytest.mark.run(after='test_run_all_common_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_run_share_mode_setup_tests(self): def test_run_share_mode_setup_tests(self):
self.run_all_share_mode_setup_tests() self.run_all_share_mode_setup_tests()
self.run_all_share_mode_started_tests(False) self.run_all_share_mode_started_tests(False)
@pytest.mark.run(order=3) @pytest.mark.run(after='test_run_share_mode_setup_tests')
@pytest.mark.tor @pytest.mark.tor
def test_tor_killed_statusbar_message_shown(self): def test_tor_killed_statusbar_message_shown(self):
self.tor_killed_statusbar_message_shown(self.gui.share_mode) self.tor_killed_statusbar_message_shown(self.gui.share_mode)
@pytest.mark.run(order=4) @pytest.mark.run(after='test_tor_killed_statusbar_message_shown')
@pytest.mark.tor @pytest.mark.tor
def test_server_is_stopped(self): def test_server_is_stopped(self):
self.server_is_stopped(self.gui.share_mode, False) self.server_is_stopped(self.gui.share_mode, False)
@pytest.mark.run(order=5) @pytest.mark.run(after='test_tor_killed_statusbar_message_shown')
@pytest.mark.tor @pytest.mark.tor
def test_web_service_is_stopped(self): def test_web_service_is_stopped(self):
self.web_service_is_stopped() self.web_service_is_stopped()