mirror of
https://github.com/open-mmlab/mmengine.git
synced 2025-06-03 21:54:44 +08:00
[Fix] Ignore the distributed tests for macOS platform (#821)
* only test timer in linux * Fix merge_stage_test.yml * remove install ffmpeg * test_ci * test_ci * Fix python -m pip install pip --upgrade to pip install * don't test unittest with sleep 1 in windows * debug with tmate * increase timeout * increase timeout * skip test gloo * skip test gloo * fix synteax error * skip test gloo in torch 1.13 * skip test gloo in torch 1.13 * skip testing setup_env in macOS * skip test test_dist * skip test setup * restore triggered during push * clean the code * debug macos * refine macOS CI * test merge stage test * trigger CI during push to main * Fix as comment
This commit is contained in:
parent
eb803f8702
commit
c382f8a5d5
39
.github/workflows/merge_stage_test.yml
vendored
39
.github/workflows/merge_stage_test.yml
vendored
@ -73,6 +73,8 @@ jobs:
|
|||||||
torchvision: 0.12.0
|
torchvision: 0.12.0
|
||||||
- torch: 1.12.0
|
- torch: 1.12.0
|
||||||
torchvision: 0.13.0
|
torchvision: 0.13.0
|
||||||
|
- torch: 1.13.0
|
||||||
|
torchvision: 0.14.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
@ -92,9 +94,11 @@ jobs:
|
|||||||
mim install 'mmcv>=2.0.0rc1'
|
mim install 'mmcv>=2.0.0rc1'
|
||||||
- name: Run unittests and generate coverage report
|
- name: Run unittests and generate coverage report
|
||||||
run: |
|
run: |
|
||||||
|
if [[ ${{ matrix.torch }} == "1.13.0" ]]; then
|
||||||
|
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist
|
||||||
|
else
|
||||||
coverage run --branch --source mmengine -m pytest tests/
|
coverage run --branch --source mmengine -m pytest tests/
|
||||||
coverage xml
|
fi
|
||||||
coverage report -m
|
|
||||||
# Only upload coverage report for python3.7 && pytorch1.8.1 cpu
|
# Only upload coverage report for python3.7 && pytorch1.8.1 cpu
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
if: ${{matrix.torch == '1.8.1' && matrix.python-version == '3.7'}}
|
if: ${{matrix.torch == '1.8.1' && matrix.python-version == '3.7'}}
|
||||||
@ -125,7 +129,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Upgrade pip
|
- name: Upgrade pip
|
||||||
run: python -m pip install pip --upgrade
|
run: pip install pip --upgrade
|
||||||
- name: Fetch GPG keys
|
- name: Fetch GPG keys
|
||||||
run: |
|
run: |
|
||||||
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
|
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
|
||||||
@ -159,7 +163,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Upgrade pip
|
- name: Upgrade pip
|
||||||
run: python -m pip install pip --upgrade
|
run: pip install pip --upgrade
|
||||||
- name: Fetch GPG keys
|
- name: Fetch GPG keys
|
||||||
run: |
|
run: |
|
||||||
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
|
apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
|
||||||
@ -173,9 +177,10 @@ jobs:
|
|||||||
pip install -r requirements/tests.txt
|
pip install -r requirements/tests.txt
|
||||||
pip install openmim
|
pip install openmim
|
||||||
mim install 'mmcv>=2.0.0rc1'
|
mim install 'mmcv>=2.0.0rc1'
|
||||||
|
# Distributed related unit test may randomly error in PyTorch 1.13.0
|
||||||
- name: Run unittests and generate coverage report
|
- name: Run unittests and generate coverage report
|
||||||
run: |
|
run: |
|
||||||
coverage run --branch --source mmengine -m pytest tests/
|
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist/
|
||||||
coverage xml
|
coverage xml
|
||||||
coverage report -m
|
coverage report -m
|
||||||
|
|
||||||
@ -192,6 +197,30 @@ jobs:
|
|||||||
torchvision: 0.9.1
|
torchvision: 0.9.1
|
||||||
- torch: 1.13.0
|
- torch: 1.13.0
|
||||||
torchvision: 0.14.0
|
torchvision: 0.14.0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Python 3.7
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
- name: Upgrade pip
|
||||||
|
run: pip install pip --upgrade
|
||||||
|
- name: Install PyTorch
|
||||||
|
run: pip install torch==${{ matrix.torch }} torchvision==${{ matrix.torchvision }}
|
||||||
|
- name: Build MMEngine from source
|
||||||
|
run: pip install -e . -v
|
||||||
|
- name: Install unit tests dependencies
|
||||||
|
run: |
|
||||||
|
pip install -r requirements/tests.txt
|
||||||
|
pip install openmim
|
||||||
|
mim install 'mmcv>=2.0.0rc1'
|
||||||
|
# Distributed-related unit tests may fail in macOS
|
||||||
|
# Skip testing setup_env since it does not work in the current CI environment # TODO
|
||||||
|
- name: Run unittests and generate coverage report
|
||||||
|
run: |
|
||||||
|
coverage run --branch --source mmengine -m pytest tests/ --ignore tests/test_dist/ --ignore tests/test_utils/test_dl_utils/test_setup_env.py
|
||||||
|
coverage xml
|
||||||
|
coverage report -m
|
||||||
|
|
||||||
build_windows:
|
build_windows:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
# Copyright (c) OpenMMLab. All rights reserved.
|
# Copyright (c) OpenMMLab. All rights reserved.
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import time
|
import time
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
from unittest import skipIf
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import mmengine
|
import mmengine
|
||||||
@ -39,6 +41,9 @@ class TestProgressBar:
|
|||||||
prog_bar.start()
|
prog_bar.start()
|
||||||
assert out.getvalue() == f'[{" " * bar_width}] 0/10, elapsed: 0s, ETA:'
|
assert out.getvalue() == f'[{" " * bar_width}] 0/10, elapsed: 0s, ETA:'
|
||||||
|
|
||||||
|
@skipIf(
|
||||||
|
platform.system() != 'Linux',
|
||||||
|
reason='Only test `TestProgressBar.test_update` in Linux')
|
||||||
def test_update(self):
|
def test_update(self):
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
bar_width = 20
|
bar_width = 20
|
||||||
@ -57,6 +62,9 @@ class TestProgressBar:
|
|||||||
assert out.getvalue() == f'\r[{">" * 2 + " " * 18}] 1/10, 1.0 ' \
|
assert out.getvalue() == f'\r[{">" * 2 + " " * 18}] 1/10, 1.0 ' \
|
||||||
'task/s, elapsed: 1s, ETA: 9s'
|
'task/s, elapsed: 1s, ETA: 9s'
|
||||||
|
|
||||||
|
@skipIf(
|
||||||
|
platform.system() != 'Linux',
|
||||||
|
reason='Only test `TestProgressBar.test_adaptive_length` in Linux')
|
||||||
def test_adaptive_length(self):
|
def test_adaptive_length(self):
|
||||||
with patch.dict('os.environ', {'COLUMNS': '80'}):
|
with patch.dict('os.environ', {'COLUMNS': '80'}):
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
@ -83,6 +91,9 @@ def sleep_1s(num):
|
|||||||
return num
|
return num
|
||||||
|
|
||||||
|
|
||||||
|
@skipIf(
|
||||||
|
platform.system() != 'Linux',
|
||||||
|
reason='Only test `test_track_progress_list` in Linux')
|
||||||
def test_track_progress_list():
|
def test_track_progress_list():
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
ret = mmengine.track_progress(sleep_1s, [1, 2, 3], bar_width=3, file=out)
|
ret = mmengine.track_progress(sleep_1s, [1, 2, 3], bar_width=3, file=out)
|
||||||
@ -94,6 +105,9 @@ def test_track_progress_list():
|
|||||||
assert ret == [1, 2, 3]
|
assert ret == [1, 2, 3]
|
||||||
|
|
||||||
|
|
||||||
|
@skipIf(
|
||||||
|
platform.system() != 'Linux',
|
||||||
|
reason='Only test `test_track_progress_iterator` in Linux')
|
||||||
def test_track_progress_iterator():
|
def test_track_progress_iterator():
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
ret = mmengine.track_progress(
|
ret = mmengine.track_progress(
|
||||||
@ -106,6 +120,9 @@ def test_track_progress_iterator():
|
|||||||
assert ret == [1, 2, 3]
|
assert ret == [1, 2, 3]
|
||||||
|
|
||||||
|
|
||||||
|
@skipIf(
|
||||||
|
platform.system() != 'Linux',
|
||||||
|
reason='Only test `test_track_iter_progress` in Linux')
|
||||||
def test_track_iter_progress():
|
def test_track_iter_progress():
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
ret = []
|
ret = []
|
||||||
@ -119,6 +136,9 @@ def test_track_iter_progress():
|
|||||||
assert ret == [1, 2, 3]
|
assert ret == [1, 2, 3]
|
||||||
|
|
||||||
|
|
||||||
|
@skipIf(
|
||||||
|
platform.system() != 'Linux',
|
||||||
|
reason='Only test `test_track_enum_progress` in Linux')
|
||||||
def test_track_enum_progress():
|
def test_track_enum_progress():
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
ret = []
|
ret = []
|
||||||
@ -136,6 +156,9 @@ def test_track_enum_progress():
|
|||||||
assert count == [0, 1, 2]
|
assert count == [0, 1, 2]
|
||||||
|
|
||||||
|
|
||||||
|
@skipIf(
|
||||||
|
platform.system() != 'Linux',
|
||||||
|
reason='Only test `test_track_parallel_progress_list` in Linux')
|
||||||
def test_track_parallel_progress_list():
|
def test_track_parallel_progress_list():
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
results = mmengine.track_parallel_progress(
|
results = mmengine.track_parallel_progress(
|
||||||
@ -150,6 +173,9 @@ def test_track_parallel_progress_list():
|
|||||||
assert results == [1, 2, 3, 4]
|
assert results == [1, 2, 3, 4]
|
||||||
|
|
||||||
|
|
||||||
|
@skipIf(
|
||||||
|
platform.system() != 'Linux',
|
||||||
|
reason='Only test `test_track_parallel_progress_iterator` in Linux')
|
||||||
def test_track_parallel_progress_iterator():
|
def test_track_parallel_progress_iterator():
|
||||||
out = StringIO()
|
out = StringIO()
|
||||||
results = mmengine.track_parallel_progress(
|
results = mmengine.track_parallel_progress(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user