mirror of https://github.com/open-mmlab/mmcv.git
Remove pytest from the runtime dependencies (#763)
* update the CI to avoid extra dependencies * remove the dependency of pytest * fix typo * remove skip_no_parrots from __init__pull/764/head
parent
5d488e4a2a
commit
c1acedcc3b
|
@ -41,12 +41,13 @@ jobs:
|
|||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
|
||||
- name: Install unittest dependencies
|
||||
run: pip install -r requirements/test.txt
|
||||
- name: Build and install
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Validate the installation
|
||||
run: python -c "import mmcv"
|
||||
- name: Run unittests and generate coverage report
|
||||
run: |
|
||||
pip install -r requirements/test.txt
|
||||
pytest tests/ --ignore=tests/test_runner --ignore=tests/test_optimizer.py --ignore=tests/test_cnn --ignore=tests/test_parallel.py --ignore=tests/test_ops --ignore=tests/test_load_model_zoo.py --ignore=tests/test_utils/test_logging.py --ignore=tests/test_image/test_io.py --ignore=tests/test_utils/test_registry.py --ignore=tests/test_utils/test_parrots_jit.py
|
||||
|
||||
build_without_ops:
|
||||
|
@ -70,12 +71,14 @@ jobs:
|
|||
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
|
||||
- name: Install PyTorch
|
||||
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- name: Install unittest dependencies
|
||||
run: pip install -r requirements/test.txt
|
||||
- name: Build and install
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Validate the installation
|
||||
run: python -c "import mmcv"
|
||||
- name: Run unittests
|
||||
run: pytest tests/ --ignore=tests/test_ops
|
||||
run: |
|
||||
pip install -r requirements/test.txt
|
||||
pytest tests/ --ignore=tests/test_ops
|
||||
|
||||
build_cpu:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -107,12 +110,13 @@ jobs:
|
|||
if: ${{matrix.torchvision == '0.4.2'}}
|
||||
- name: Install PyTorch
|
||||
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- name: Install unittest dependencies
|
||||
run: pip install -r requirements/test.txt
|
||||
- name: Build and install
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Validate the installation
|
||||
run: python -c "import mmcv"
|
||||
- name: Run unittests and generate coverage report
|
||||
run: |
|
||||
pip install -r requirements/test.txt
|
||||
coverage run --branch --source=mmcv -m pytest tests/
|
||||
coverage xml
|
||||
coverage report -m
|
||||
|
@ -174,12 +178,13 @@ jobs:
|
|||
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
|
||||
- name: Install unittest dependencies
|
||||
run: pip install -r requirements/test.txt
|
||||
- name: Build and install
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Validate the installation
|
||||
run: python -c "import mmcv"
|
||||
- name: Run unittests and generate coverage report
|
||||
run: |
|
||||
pip install -r requirements/test.txt
|
||||
coverage run --branch --source=mmcv -m pytest tests/ --ignore=tests/test_ops/test_onnx.py
|
||||
coverage xml
|
||||
coverage report -m
|
||||
|
@ -216,8 +221,6 @@ jobs:
|
|||
python-version: 3.7
|
||||
- name: Install system dependencies
|
||||
run: brew install ffmpeg jpeg-turbo
|
||||
- name: Install unittest dependencies
|
||||
run: pip install -r requirements/test.txt
|
||||
- name: Install Pillow
|
||||
run: pip install Pillow==6.2.2
|
||||
if: ${{matrix.torchvision == '0.4.2'}}
|
||||
|
@ -227,7 +230,10 @@ jobs:
|
|||
run: |
|
||||
rm -rf .eggs
|
||||
CC=clang CXX=clang++ CFLAGS='-stdlib=libc++' pip install -e .
|
||||
- name: Validate the installation
|
||||
run: python -c "import mmcv"
|
||||
- name: Run unittests
|
||||
run: |
|
||||
pip install -r requirements/test.txt
|
||||
# The timing on macos VMs is not precise, so we skip the progressbar tests
|
||||
pytest tests/ --ignore tests/test_utils/test_progressbar.py --ignore tests/test_utils/test_timer.py
|
||||
|
|
|
@ -33,7 +33,7 @@ else:
|
|||
DataLoader, PoolDataLoader, SyncBatchNorm, _AdaptiveAvgPoolNd,
|
||||
_AdaptiveMaxPoolNd, _AvgPoolNd, _BatchNorm, _ConvNd,
|
||||
_ConvTransposeMixin, _InstanceNorm, _MaxPoolNd, get_build_config)
|
||||
from .parrots_jit import jit, skip_no_elena, skip_no_parrots
|
||||
from .parrots_jit import jit, skip_no_elena
|
||||
from .registry import Registry, build_from_cfg
|
||||
__all__ = [
|
||||
'Config', 'ConfigDict', 'DictAction', 'collect_env', 'get_logger',
|
||||
|
@ -49,6 +49,5 @@ else:
|
|||
'_InstanceNorm', '_MaxPoolNd', 'get_build_config', 'BuildExtension',
|
||||
'CppExtension', 'CUDAExtension', 'DataLoader', 'PoolDataLoader',
|
||||
'TORCH_VERSION', 'deprecated_api_warning', 'digit_version',
|
||||
'get_git_hash', 'import_modules_from_strings', 'jit', 'skip_no_elena',
|
||||
'skip_no_parrots'
|
||||
'get_git_hash', 'import_modules_from_strings', 'jit', 'skip_no_elena'
|
||||
]
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import pytest
|
||||
import torch
|
||||
|
||||
TORCH_VERSION = torch.__version__
|
||||
from .parrots_wrapper import TORCH_VERSION
|
||||
|
||||
if TORCH_VERSION == 'parrots':
|
||||
from parrots.jit import pat as jit
|
||||
|
@ -37,11 +34,3 @@ else:
|
|||
return func(*args, **kargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
|
||||
def is_using_parrots():
|
||||
return TORCH_VERSION == 'parrots'
|
||||
|
||||
|
||||
skip_no_parrots = pytest.mark.skipif(
|
||||
not is_using_parrots(), reason='test case under parrots environment')
|
||||
|
|
|
@ -2,6 +2,10 @@ import pytest
|
|||
import torch
|
||||
|
||||
import mmcv
|
||||
from mmcv.utils import TORCH_VERSION
|
||||
|
||||
skip_no_parrots = pytest.mark.skipif(
|
||||
TORCH_VERSION != 'parrots', reason='test case under parrots environment')
|
||||
|
||||
|
||||
class TestJit(object):
|
||||
|
@ -55,7 +59,7 @@ class TestJit(object):
|
|||
assert f'k{idx}' in rets_t
|
||||
assert (rets[f'k{idx}'] == rets_t[f'k{idx}']).all()
|
||||
|
||||
@mmcv.skip_no_parrots
|
||||
@skip_no_parrots
|
||||
def test_jit_cache(self):
|
||||
|
||||
@mmcv.jit
|
||||
|
@ -88,7 +92,7 @@ class TestJit(object):
|
|||
rets_a = (rets_minus_t + rets_plus_t) / 4
|
||||
assert torch.allclose(oper['x'], rets_a)
|
||||
|
||||
@mmcv.skip_no_parrots
|
||||
@skip_no_parrots
|
||||
def test_jit_shape(self):
|
||||
|
||||
@mmcv.jit
|
||||
|
@ -109,7 +113,7 @@ class TestJit(object):
|
|||
assert (r == 2).all()
|
||||
assert len(func._cache._cache) == 2
|
||||
|
||||
@mmcv.skip_no_parrots
|
||||
@skip_no_parrots
|
||||
def test_jit_kwargs(self):
|
||||
|
||||
@mmcv.jit
|
||||
|
@ -206,7 +210,7 @@ class TestJit(object):
|
|||
d = pyfunc(a, b)
|
||||
assert torch.allclose(c, d)
|
||||
|
||||
@mmcv.skip_no_parrots
|
||||
@skip_no_parrots
|
||||
def test_jit_check_input(self):
|
||||
|
||||
def func(x):
|
||||
|
@ -217,7 +221,7 @@ class TestJit(object):
|
|||
with pytest.raises(AssertionError):
|
||||
func = mmcv.jit(func, check_input=(a, ))
|
||||
|
||||
@mmcv.skip_no_parrots
|
||||
@skip_no_parrots
|
||||
def test_jit_partial_shape(self):
|
||||
|
||||
@mmcv.jit(full_shape=False)
|
||||
|
|
Loading…
Reference in New Issue