[tests] move fixtures to conftest.py

This commit is contained in:
Sam Schott 2020-11-19 17:45:28 +00:00
parent cb4ff07e2f
commit 99b6a5b782
5 changed files with 6 additions and 26 deletions

View File

@ -46,5 +46,5 @@ tests will set this environment variable for you with a temporary access token t
expires after 4 hours. Tests are run on `ubuntu-latest` and `macos-latest` in parallel expires after 4 hours. Tests are run on `ubuntu-latest` and `macos-latest` in parallel
on different accounts and you should acquire a "lock" on the account before running on different accounts and you should acquire a "lock" on the account before running
tests. Fixtures to create and clean up a test config and to acquire a lock are provided tests. Fixtures to create and clean up a test config and to acquire a lock are provided
in the `fixtures` module. If you run the tests locally, you will need to provide an in the `tests/linked/conftest.py`. If you run the tests locally, you will need to
access token for your own Dropbox account. provide an access token for your own Dropbox account.

View File

@ -1,20 +0,0 @@
The test suite uses [unittest](https://docs.python.org/3.8/library/unittest.html)
to both write and run tests.
Test are grouped into those which require a linked Dropbox account ("linked") and those
who can run by themselves ("offline"). The former tend to be integration test while the
latter are mostly unit tests. The current focus lies on integration tests, especially
for the sync engine, as they are easier to maintain when the implementation and internal
APIs change. Exceptions are made for performance tests, for instance for indexing and
cleaning up sync events, and for particularly complex functions that are prone to
regressions.
The current test suite uses a Dropbox access token provided by the environment variable
`DROPBOX_TOKEN` to connect to a real account. The GitHub action which is running the
tests will set this environment variable for you with a temporary access token that
expires after 4 hours. Tests are run on `ubuntu-latest` and `macos-latest` in parallel
on different accounts and you should acquire a "lock" on the account before running
tests. Fixtures to create and clean up a test config and to acquire a lock are provided
in the `tests.linked.fixtures` module. If you run the tests locally, you will need to
provide an access token for your own Dropbox account.

View File

@ -10,7 +10,7 @@ from maestral.main import FileStatus, IDLE
from maestral.main import logger as maestral_logger from maestral.main import logger as maestral_logger
from maestral.utils.path import delete from maestral.utils.path import delete
from .fixtures import wait_for_idle, m from .conftest import wait_for_idle
if not os.environ.get("DROPBOX_TOKEN"): if not os.environ.get("DROPBOX_TOKEN"):

View File

@ -14,7 +14,7 @@ from maestral.sync import delete, move
from maestral.sync import is_fs_case_sensitive from maestral.sync import is_fs_case_sensitive
from maestral.sync import DirectorySnapshot, SyncEvent from maestral.sync import DirectorySnapshot, SyncEvent
from .fixtures import m, assert_synced, wait_for_idle, resources from .conftest import assert_synced, wait_for_idle, resources
if not os.environ.get("DROPBOX_TOKEN"): if not os.environ.get("DROPBOX_TOKEN"):