mirror of
https://github.com/samschott/maestral.git
synced 2024-09-22 03:18:33 +03:00
support running tests with kqueue backend
This commit is contained in:
parent
6f8eeced7d
commit
071f9337d5
29
.github/workflows/test.yml
vendored
29
.github/workflows/test.yml
vendored
@ -60,13 +60,10 @@ jobs:
|
||||
name: Linked unit tests
|
||||
needs: offline-tests
|
||||
strategy:
|
||||
max-parallel: 2
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, macos-latest]
|
||||
python-version: ['3.10', ]
|
||||
include:
|
||||
# use two different Dropbox accounts to run tests in parallel
|
||||
- platform: ubuntu-latest
|
||||
token: DROPBOX_REFRESH_TOKEN_1
|
||||
|
||||
@ -86,10 +83,10 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
if: github.event_name != 'pull_request_target'
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
@ -129,19 +126,23 @@ jobs:
|
||||
name: Linked integration tests
|
||||
needs: linked-unit-tests
|
||||
strategy:
|
||||
max-parallel: 2
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest, macos-latest]
|
||||
python-version: ['3.10', ]
|
||||
observer: [inotify, fsevents, kqueue]
|
||||
include:
|
||||
# use two different Dropbox accounts to run tests in parallel
|
||||
- platform: ubuntu-latest
|
||||
- observer: inotify
|
||||
platform: ubuntu-latest
|
||||
token: DROPBOX_REFRESH_TOKEN_1
|
||||
|
||||
- platform: macos-latest
|
||||
- observer: fsevents
|
||||
platform: macos-latest
|
||||
token: DROPBOX_REFRESH_TOKEN_2
|
||||
|
||||
- observer: kqueue
|
||||
platform: macos-latest
|
||||
token: DROPBOX_REFRESH_TOKEN_3
|
||||
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Checkout merge commit
|
||||
@ -155,10 +156,10 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
if: github.event_name != 'pull_request_target'
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
@ -180,7 +181,7 @@ jobs:
|
||||
|
||||
- name: Test with pytest
|
||||
run: |
|
||||
pytest -x --verbose --cov=maestral --cov-report=xml tests/linked/integration
|
||||
pytest -x --verbose --cov=maestral --cov-report=xml tests/linked/integration --fs-observer ${{ matrix.observer }}
|
||||
|
||||
- name: Upload Code Coverage
|
||||
uses: codecov/codecov-action@v3
|
||||
|
@ -4,6 +4,7 @@ import time
|
||||
|
||||
import pytest
|
||||
|
||||
import maestral.manager
|
||||
from maestral.main import Maestral
|
||||
from maestral.config import remove_configuration
|
||||
from maestral.utils.path import generate_cc_name, delete
|
||||
@ -20,13 +21,37 @@ fsevents_logger = logging.getLogger("fsevents")
|
||||
fsevents_logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption("--fs-observer", action="store", default="auto", dest="OBSERVER")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def m():
|
||||
def m(pytestconfig):
|
||||
"""
|
||||
Returns a Maestral instance linked to a test account and syncing. Acquires a lock
|
||||
on the account for the duration of the test and removes all items from the server
|
||||
after completing the test.
|
||||
"""
|
||||
|
||||
# Patch file event observer backend if requested.
|
||||
if pytestconfig.option.OBSERVER == "inotify":
|
||||
from watchdog.observers.inotify import InotifyObserver
|
||||
|
||||
maestral.manager.Observer = InotifyObserver
|
||||
elif pytestconfig.option.OBSERVER == "fsevents":
|
||||
from watchdog.observers.fsevents import FSEventsObserver
|
||||
|
||||
maestral.manager.Observer = FSEventsObserver
|
||||
elif pytestconfig.option.OBSERVER == "kqueue":
|
||||
from watchdog.observers.kqueue import KqueueObserver
|
||||
|
||||
maestral.manager.Observer = KqueueObserver
|
||||
elif pytestconfig.option.OBSERVER == "polling":
|
||||
from maestral.fsevents.polling import OrderedPollingObserver
|
||||
|
||||
maestral.manager.Observer = OrderedPollingObserver
|
||||
|
||||
# Initialize Maestral.
|
||||
config_name = "test-config"
|
||||
|
||||
m = Maestral(config_name)
|
||||
|
Loading…
Reference in New Issue
Block a user