mirror of
https://github.com/onionshare/onionshare.git
synced 2025-04-23 16:59:13 -04:00
Make it so GUI tests only run with --rungui
This commit is contained in:
parent
6cb7670037
commit
b39eb126c0
tests
conftest.pylocal_onionshare_404_public_mode_skips_ratelimit_test.pylocal_onionshare_404_triggers_ratelimit_test.pylocal_onionshare_quitting_during_share_prompts_warning_test.pylocal_onionshare_receive_mode_sender_closed_test.pylocal_onionshare_receive_mode_timer_test.pylocal_onionshare_receive_mode_upload_non_writable_dir_test.pylocal_onionshare_receive_mode_upload_public_mode_non_writable_dir_test.pylocal_onionshare_receive_mode_upload_public_mode_test.pylocal_onionshare_receive_mode_upload_test.pylocal_onionshare_settings_dialog_legacy_tor_test.pylocal_onionshare_settings_dialog_no_tor_test.pylocal_onionshare_settings_dialog_v3_tor_test.pylocal_onionshare_share_mode_download_public_mode_test.pylocal_onionshare_share_mode_download_stay_open_test.pylocal_onionshare_share_mode_download_test.pylocal_onionshare_share_mode_large_download_test.pylocal_onionshare_share_mode_slug_persistent_test.pylocal_onionshare_share_mode_timer_test.pylocal_onionshare_share_mode_timer_too_short_test.pylocal_onionshare_share_mode_unreadable_file_test.pyonionshare_790_cancel_on_second_share_test.pyonionshare_receive_mode_upload_public_mode_test.pyonionshare_receive_mode_upload_test.pyonionshare_share_mode_cancel_share_test.pyonionshare_share_mode_download_public_mode_test.pyonionshare_share_mode_download_stay_open_test.pyonionshare_share_mode_download_test.pyonionshare_share_mode_persistent_test.pyonionshare_share_mode_stealth_test.pyonionshare_share_mode_timer_test.pyonionshare_share_mode_tor_connection_killed_test.pyonionshare_share_mode_v2_onion_test.py
@ -11,19 +11,28 @@ import pytest
|
||||
from onionshare import common, web, settings, strings
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption(
|
||||
"--rungui", action="store_true", default=False, help="run GUI tests"
|
||||
)
|
||||
parser.addoption(
|
||||
"--runtor", action="store_true", default=False, help="run tor tests"
|
||||
)
|
||||
|
||||
|
||||
def pytest_collection_modifyitems(config, items):
|
||||
if config.getoption("--runtor"):
|
||||
if not config.getoption("--runtor"):
|
||||
# --runtor given in cli: do not skip tor tests
|
||||
return
|
||||
skip_tor = pytest.mark.skip(reason="need --runtor option to run")
|
||||
for item in items:
|
||||
if "tor" in item.keywords:
|
||||
item.add_marker(skip_tor)
|
||||
skip_tor = pytest.mark.skip(reason="need --runtor option to run")
|
||||
for item in items:
|
||||
if "tor" in item.keywords:
|
||||
item.add_marker(skip_tor)
|
||||
|
||||
if not config.getoption('--rungui'):
|
||||
# --rungui given in cli: do not skip GUI tests
|
||||
skip_gui = pytest.mark.skip(reason="need --rungui option to run")
|
||||
for item in items:
|
||||
if "gui" in item.keywords:
|
||||
item.add_marker(skip_gui)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiShareTest import GuiShareTest
|
||||
@ -16,6 +17,7 @@ class Local404PublicModeRateLimitTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_tests(True, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiShareTest import GuiShareTest
|
||||
@ -15,6 +16,7 @@ class Local404RateLimitTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_tests(False, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
from PyQt5 import QtCore, QtTest
|
||||
|
||||
@ -16,6 +17,7 @@ class LocalQuittingDuringSharePromptsWarningTest(unittest.TestCase, GuiShareTest
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_tests(False, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiReceiveTest import GuiReceiveTest
|
||||
@ -15,6 +16,7 @@ class LocalReceiveModeSenderClosedTest(unittest.TestCase, GuiReceiveTest):
|
||||
def tearDownClass(cls):
|
||||
GuiReceiveTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_receive_mode_tests(False, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiReceiveTest import GuiReceiveTest
|
||||
@ -16,6 +17,7 @@ class LocalReceiveModeTimerTest(unittest.TestCase, GuiReceiveTest):
|
||||
def tearDownClass(cls):
|
||||
GuiReceiveTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_receive_mode_timer_tests(False)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiReceiveTest import GuiReceiveTest
|
||||
@ -15,6 +16,7 @@ class LocalReceiveModeUnwritableTest(unittest.TestCase, GuiReceiveTest):
|
||||
def tearDownClass(cls):
|
||||
GuiReceiveTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_receive_mode_unwritable_dir_tests(False, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiReceiveTest import GuiReceiveTest
|
||||
@ -16,6 +17,7 @@ class LocalReceivePublicModeUnwritableTest(unittest.TestCase, GuiReceiveTest):
|
||||
def tearDownClass(cls):
|
||||
GuiReceiveTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_receive_mode_unwritable_dir_tests(True, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiReceiveTest import GuiReceiveTest
|
||||
@ -16,6 +17,7 @@ class LocalReceiveModePublicModeTest(unittest.TestCase, GuiReceiveTest):
|
||||
def tearDownClass(cls):
|
||||
GuiReceiveTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_receive_mode_tests(True, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiReceiveTest import GuiReceiveTest
|
||||
@ -15,6 +16,7 @@ class LocalReceiveModeTest(unittest.TestCase, GuiReceiveTest):
|
||||
def tearDownClass(cls):
|
||||
GuiReceiveTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_receive_mode_tests(False, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from onionshare import strings
|
||||
@ -14,6 +15,7 @@ class SettingsGuiTest(unittest.TestCase, SettingsGuiBaseTest):
|
||||
def tearDownClass(cls):
|
||||
SettingsGuiBaseTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui_legacy_tor(self):
|
||||
self.gui.onion = OnionStub(True, False)
|
||||
self.gui.reload_settings()
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from onionshare import strings
|
||||
@ -14,6 +15,7 @@ class SettingsGuiTest(unittest.TestCase, SettingsGuiBaseTest):
|
||||
def tearDownClass(cls):
|
||||
SettingsGuiBaseTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui_no_tor(self):
|
||||
self.gui.onion = OnionStub(False, False)
|
||||
self.gui.reload_settings()
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from onionshare import strings
|
||||
@ -14,6 +15,7 @@ class SettingsGuiTest(unittest.TestCase, SettingsGuiBaseTest):
|
||||
def tearDownClass(cls):
|
||||
SettingsGuiBaseTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui_v3_tor(self):
|
||||
self.gui.onion = OnionStub(True, True)
|
||||
self.gui.reload_settings()
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiShareTest import GuiShareTest
|
||||
@ -15,6 +16,7 @@ class LocalShareModePublicModeTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_tests(True, False)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiShareTest import GuiShareTest
|
||||
@ -15,6 +16,7 @@ class LocalShareModeStayOpenTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_tests(False, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiShareTest import GuiShareTest
|
||||
@ -14,6 +15,7 @@ class LocalShareModeTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_tests(False, False)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiShareTest import GuiShareTest
|
||||
@ -14,6 +15,7 @@ class LocalShareModeLargeDownloadTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_large_file_tests(False, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiShareTest import GuiShareTest
|
||||
@ -18,6 +19,7 @@ class LocalShareModePersistentSlugTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_persistent_tests(False, True)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiShareTest import GuiShareTest
|
||||
@ -16,6 +17,7 @@ class LocalShareModeTimerTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_timer_tests(False)
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
from PyQt5 import QtCore, QtTest
|
||||
|
||||
@ -17,6 +18,7 @@ class LocalShareModeTimerTooShortTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_setup_tests()
|
||||
|
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import pytest
|
||||
import unittest
|
||||
|
||||
from .GuiShareTest import GuiShareTest
|
||||
@ -14,6 +15,7 @@ class LocalShareModeUnReadableFileTest(unittest.TestCase, GuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
GuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
self.run_all_share_mode_unreadable_file_tests()
|
||||
|
@ -9,7 +9,7 @@ class ShareModeCancelSecondShareTest(unittest.TestCase, TorGuiShareTest):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
test_settings = {
|
||||
"close_after_first_download": True
|
||||
"close_after_first_download": True
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@ -17,6 +17,7 @@ class ShareModeCancelSecondShareTest(unittest.TestCase, TorGuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -17,6 +17,7 @@ class ReceiveModeTest(unittest.TestCase, TorGuiReceiveTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiReceiveTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -16,6 +16,7 @@ class ReceiveModeTest(unittest.TestCase, TorGuiReceiveTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiReceiveTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -15,6 +15,7 @@ class ShareModeCancelTest(unittest.TestCase, TorGuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -16,6 +16,7 @@ class ShareModePublicModeTest(unittest.TestCase, TorGuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -16,6 +16,7 @@ class ShareModeStayOpenTest(unittest.TestCase, TorGuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -15,6 +15,7 @@ class ShareModeTest(unittest.TestCase, TorGuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -20,6 +20,7 @@ class ShareModePersistentSlugTest(unittest.TestCase, TorGuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -17,6 +17,7 @@ class ShareModeStealthTest(unittest.TestCase, TorGuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -17,6 +17,7 @@ class ShareModeTimerTest(unittest.TestCase, TorGuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -11,6 +11,7 @@ class ShareModeTorConnectionKilledTest(unittest.TestCase, TorGuiShareTest):
|
||||
}
|
||||
cls.gui = TorGuiShareTest.set_up(test_settings)
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
@ -16,6 +16,7 @@ class ShareModeV2OnionTest(unittest.TestCase, TorGuiShareTest):
|
||||
def tearDownClass(cls):
|
||||
TorGuiShareTest.tear_down()
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.tor
|
||||
def test_gui(self):
|
||||
self.run_all_common_setup_tests()
|
||||
|
Loading…
x
Reference in New Issue
Block a user