Skip to content

Commit

Permalink
skip some tests on Windows
Browse files Browse the repository at this point in the history
pytest-celery is not supported on Windows.
  • Loading branch information
skshetry committed May 10, 2024
1 parent a5dfe35 commit 44af473
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ jobs:
pip --version
nox --version
# https://github.com/iterative/pytest-servers/pull/122
# https://github.com/abiosoft/colima/issues/468
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
# colima v0.5.6 seems to run more stable than the latest - that has occasional network failures (ports are not open)
# see: https://github.com/abiosoft/colima/issues/962
- name: Use colima as default docker host on MacOS
if: runner.os == 'macOS'
run: |
brew install docker lima || true # avoid non-zero exit code if brew link fails
sudo curl -L -o /usr/local/bin/colima https://github.com/abiosoft/colima/releases/download/v0.5.6/colima-Darwin-x86_64
sudo chmod +x /usr/local/bin/colima
colima start
sudo ln -vsf "${HOME}"/.colima/default/docker.sock /var/run/docker.sock
env:
HOMEBREW_NO_AUTO_UPDATE: true
HOMEBREW_NO_INSTALL_CLEANUP: true
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: true
HOMEBREW_NO_INSTALL_UPGRADE: true

- name: Lint code and check dependencies
run: nox -s lint safety

Expand Down
2 changes: 2 additions & 0 deletions tests/proc/test_tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Process task tests."""

import os
from typing import Any, Dict

import pytest
Expand All @@ -10,6 +11,7 @@
from dvc_task.proc.tasks import run


@pytest.mark.skipif(os.name == "nt")
@pytest.mark.usefixtures("celery_app", "celery_worker")
def test_run(
tmp_dir: TmpDir,
Expand Down
3 changes: 3 additions & 0 deletions tests/worker/test_temporary.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Temporary Worker tests."""

import os
import sys

import pytest
Expand Down Expand Up @@ -28,6 +29,7 @@ def test_start(celery_app: Celery, mocker: MockerFixture):
thread.assert_called_once_with(target=worker.monitor, daemon=True, args=(name,))


@pytest.mark.skipif(os.name == "nt")
@pytest.mark.flaky(reruns=3, condition=sys.platform == "darwin")
def test_start_already_exists(
celery_app: Celery,
Expand All @@ -43,6 +45,7 @@ def test_start_already_exists(
thread.assert_not_called()


@pytest.mark.skipif(os.name == "nt")
@pytest.mark.flaky(reruns=3, condition=sys.platform == "darwin")
def test_monitor(
celery_app: Celery,
Expand Down

0 comments on commit 44af473

Please sign in to comment.