diff --git a/.travis.yml b/.travis.yml index afbaa887..a41339cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,6 @@ before_script: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics # command to run tests -script: pytest --cov=onionshare test/ +script: pytest --cov=onionshare tests/ after_success: - coveralls diff --git a/BUILD.md b/BUILD.md index 1feedf49..308a186c 100644 --- a/BUILD.md +++ b/BUILD.md @@ -137,8 +137,21 @@ This will prompt you to codesign three binaries and execute one unsigned binary. ## Tests -OnionShare includes PyTest unit tests. To run the tests: +OnionShare includes PyTest unit tests. To run the tests, first install some dependencies: ```sh -pytest test/ +pip3 install -r install/requirements-tests.txt +``` + +If you'd like to run the CLI-based tests that Travis runs: + +```sh +pytest tests/ +``` + +If you would like to run the GUI unit tests in 'local only mode': + +```sh +cd tests_gui_local/ +./run_unit_tests.sh ``` diff --git a/MANIFEST.in b/MANIFEST.in index c8a4d87c..71af3740 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -10,4 +10,4 @@ include install/onionshare.desktop include install/onionshare.appdata.xml include install/onionshare80.xpm include install/scripts/onionshare-nautilus.py -include test/*.py +include tests/*.py diff --git a/install/check_lacked_trans.py b/install/check_lacked_trans.py index 027edab1..1caa6b27 100644 --- a/install/check_lacked_trans.py +++ b/install/check_lacked_trans.py @@ -59,7 +59,7 @@ def main(): files_in(dir, 'onionshare_gui/share_mode') + \ files_in(dir, 'onionshare_gui/receive_mode') + \ files_in(dir, 'install/scripts') + \ - files_in(dir, 'test') + files_in(dir, 'tests') pysrc = [p for p in src if p.endswith('.py')] lang_code = args.lang_code diff --git a/install/requirements-tests.txt b/install/requirements-tests.txt new file mode 100644 index 00000000..0d9c1581 --- /dev/null +++ b/install/requirements-tests.txt @@ -0,0 +1,11 @@ +atomicwrites==1.2.1 +attrs==18.2.0 +more-itertools==4.3.0 +pluggy==0.6.0 +py==1.6.0 +pytest==3.4.2 +pytest-faulthandler==1.5.0 +pytest-ordering==0.5 +pytest-qt==3.1.0 +six==1.11.0 +urllib3==1.23 diff --git a/test/__init__.py b/tests/__init__.py similarity index 100% rename from test/__init__.py rename to tests/__init__.py diff --git a/test/conftest.py b/tests/conftest.py similarity index 100% rename from test/conftest.py rename to tests/conftest.py diff --git a/test/test_helpers.py b/tests/test_helpers.py similarity index 100% rename from test/test_helpers.py rename to tests/test_helpers.py diff --git a/test/test_onionshare.py b/tests/test_onionshare.py similarity index 100% rename from test/test_onionshare.py rename to tests/test_onionshare.py diff --git a/test/test_onionshare_common.py b/tests/test_onionshare_common.py similarity index 100% rename from test/test_onionshare_common.py rename to tests/test_onionshare_common.py diff --git a/test/test_onionshare_settings.py b/tests/test_onionshare_settings.py similarity index 100% rename from test/test_onionshare_settings.py rename to tests/test_onionshare_settings.py diff --git a/test/test_onionshare_strings.py b/tests/test_onionshare_strings.py similarity index 100% rename from test/test_onionshare_strings.py rename to tests/test_onionshare_strings.py diff --git a/test/test_onionshare_web.py b/tests/test_onionshare_web.py similarity index 100% rename from test/test_onionshare_web.py rename to tests/test_onionshare_web.py diff --git a/unit_tests/__init__.py b/tests_gui_local/__init__.py similarity index 100% rename from unit_tests/__init__.py rename to tests_gui_local/__init__.py diff --git a/unit_tests/commontests.py b/tests_gui_local/commontests.py similarity index 100% rename from unit_tests/commontests.py rename to tests_gui_local/commontests.py diff --git a/unit_tests/conftest.py b/tests_gui_local/conftest.py similarity index 100% rename from unit_tests/conftest.py rename to tests_gui_local/conftest.py diff --git a/unit_tests/onionshare_receive_mode_upload_test.py b/tests_gui_local/onionshare_receive_mode_upload_test.py similarity index 100% rename from unit_tests/onionshare_receive_mode_upload_test.py rename to tests_gui_local/onionshare_receive_mode_upload_test.py diff --git a/unit_tests/onionshare_receive_mode_upload_test_public_mode.py b/tests_gui_local/onionshare_receive_mode_upload_test_public_mode.py similarity index 100% rename from unit_tests/onionshare_receive_mode_upload_test_public_mode.py rename to tests_gui_local/onionshare_receive_mode_upload_test_public_mode.py diff --git a/unit_tests/onionshare_share_mode_download_test.py b/tests_gui_local/onionshare_share_mode_download_test.py similarity index 100% rename from unit_tests/onionshare_share_mode_download_test.py rename to tests_gui_local/onionshare_share_mode_download_test.py diff --git a/unit_tests/onionshare_share_mode_download_test_public_mode.py b/tests_gui_local/onionshare_share_mode_download_test_public_mode.py similarity index 100% rename from unit_tests/onionshare_share_mode_download_test_public_mode.py rename to tests_gui_local/onionshare_share_mode_download_test_public_mode.py diff --git a/unit_tests/onionshare_share_mode_download_test_stay_open.py b/tests_gui_local/onionshare_share_mode_download_test_stay_open.py similarity index 100% rename from unit_tests/onionshare_share_mode_download_test_stay_open.py rename to tests_gui_local/onionshare_share_mode_download_test_stay_open.py diff --git a/unit_tests/onionshare_slug_persistent_test.py b/tests_gui_local/onionshare_slug_persistent_test.py similarity index 100% rename from unit_tests/onionshare_slug_persistent_test.py rename to tests_gui_local/onionshare_slug_persistent_test.py diff --git a/unit_tests/onionshare_timer_test.py b/tests_gui_local/onionshare_timer_test.py similarity index 100% rename from unit_tests/onionshare_timer_test.py rename to tests_gui_local/onionshare_timer_test.py diff --git a/unit_tests/run_unit_tests.sh b/tests_gui_local/run_unit_tests.sh similarity index 100% rename from unit_tests/run_unit_tests.sh rename to tests_gui_local/run_unit_tests.sh