mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-12 04:31:41 -05:00
Adds bash script to run GUI tests individually
This commit is contained in:
parent
b129ffba86
commit
acd41b3b70
@ -51,7 +51,7 @@ jobs:
|
|||||||
- run:
|
- run:
|
||||||
name: Run unit tests
|
name: Run unit tests
|
||||||
command: |
|
command: |
|
||||||
xvfb-run -s "-screen 0 1280x1024x24" poetry run pytest --rungui -vvv --no-qt-log tests/
|
xvfb-run -s "-screen 0 1280x1024x24" poetry run ./tests/run.sh --rungui
|
||||||
|
|
||||||
test-3.7:
|
test-3.7:
|
||||||
<<: *test-template
|
<<: *test-template
|
||||||
|
8
BUILD.md
8
BUILD.md
@ -267,19 +267,19 @@ This will prompt you to codesign three binaries and execute one unsigned binary.
|
|||||||
OnionShare includes PyTest unit tests. To run tests, you can run `pytest` against the `tests/` directory.
|
OnionShare includes PyTest unit tests. To run tests, you can run `pytest` against the `tests/` directory.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
poetry run pytest tests/
|
poetry run ./tests/run.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
You can run GUI tests like this:
|
You can run GUI tests like this:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
poetry run pytest --rungui tests/
|
poetry run ./tests/run.sh --rungui
|
||||||
```
|
```
|
||||||
|
|
||||||
If you would like to also run the GUI unit tests in 'tor' mode, start Tor Browser in the background, then run:
|
If you would like to also run the GUI unit tests in 'tor' mode, start Tor Browser in the background, then run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
poetry run pytest --rungui --runtor tests/
|
poetry run ./tests/run.sh --rungui --runtor
|
||||||
```
|
```
|
||||||
|
|
||||||
Keep in mind that the Tor tests take a lot longer to run than local mode, but they are also more comprehensive.
|
Keep in mind that the Tor tests take a lot longer to run than local mode, but they are also more comprehensive.
|
||||||
@ -287,7 +287,7 @@ Keep in mind that the Tor tests take a lot longer to run than local mode, but th
|
|||||||
You can also choose to wrap the tests in `xvfb-run` so that a ton of OnionShare windows don't pop up on your desktop (you may need to install the `xorg-x11-server-Xvfb` package), like this:
|
You can also choose to wrap the tests in `xvfb-run` so that a ton of OnionShare windows don't pop up on your desktop (you may need to install the `xorg-x11-server-Xvfb` package), like this:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
xvfb-run poetry run pytest --rungui -vvv --no-qt-log tests/
|
xvfb-run poetry run ./tests/run.sh --rungui
|
||||||
```
|
```
|
||||||
|
|
||||||
# Making releases
|
# Making releases
|
||||||
|
@ -71,6 +71,7 @@ class GuiBaseTest(unittest.TestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
# Quit
|
# Quit
|
||||||
|
cls.gui.qtapp.clipboard().clear()
|
||||||
QtCore.QTimer.singleShot(200, cls.gui.close_dialog.accept_button.click)
|
QtCore.QTimer.singleShot(200, cls.gui.close_dialog.accept_button.click)
|
||||||
cls.gui.close()
|
cls.gui.close()
|
||||||
|
|
||||||
|
26
tests/run.sh
Executable file
26
tests/run.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# The script runs python tests
|
||||||
|
# Firstly, all CLI tests are run
|
||||||
|
# Then, all the GUI tests are run individually
|
||||||
|
# to avoid segmentation fault
|
||||||
|
|
||||||
|
PARAMS=""
|
||||||
|
|
||||||
|
while [ ! $# -eq 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
--rungui)
|
||||||
|
PARAMS="$PARAMS --rungui"
|
||||||
|
;;
|
||||||
|
--runtor)
|
||||||
|
PARAMS="$PARAMS --runtor"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
pytest $PARAMS -vvv ./tests/test_cli*.py
|
||||||
|
for filename in ./tests/test_gui_*.py; do
|
||||||
|
pytest $PARAMS -vvv --no-qt-log $filename
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user