diff --git a/.travis.yml b/.travis.yml index 30595047a49ab69cb0bca017e881c7c7586c75c3..5d53d790222741c1e1494762dd7215d45d6bdea4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ script: - yapf -r -d --style .style.yapf mmdet/ tools/ tests/ - python setup.py check -m -s - python setup.py build_ext --inplace - - coverage run --source mmdet -m py.test tests -v --doctest-modules + - coverage run --source mmdet -m py.test -v --xdoctest-modules tests mmdet after_success: - - coverage report \ No newline at end of file + - coverage report diff --git a/mmdet/models/bbox_heads/convfc_bbox_head.py b/mmdet/models/bbox_heads/convfc_bbox_head.py index f6659b32d85ba89d305dc2202a035cfa5a130736..777c455951f98d684d42dde47843acef9eb77375 100644 --- a/mmdet/models/bbox_heads/convfc_bbox_head.py +++ b/mmdet/models/bbox_heads/convfc_bbox_head.py @@ -7,7 +7,7 @@ from .bbox_head import BBoxHead @HEADS.register_module class ConvFCBBoxHead(BBoxHead): - """More general bbox head, with shared conv and fc layers and two optional + r"""More general bbox head, with shared conv and fc layers and two optional separated branches. /-> cls convs -> cls fcs -> cls diff --git a/mmdet/models/bbox_heads/double_bbox_head.py b/mmdet/models/bbox_heads/double_bbox_head.py index a2934a0bfe2d3da88d795e963876e1102d87b487..c8a0e269922053c7b9e92326f12e4a9778693c20 100644 --- a/mmdet/models/bbox_heads/double_bbox_head.py +++ b/mmdet/models/bbox_heads/double_bbox_head.py @@ -71,7 +71,7 @@ class BasicResBlock(nn.Module): @HEADS.register_module class DoubleConvFCBBoxHead(BBoxHead): - """Bbox head used in Double-Head R-CNN + r"""Bbox head used in Double-Head R-CNN /-> cls /-> shared convs -> diff --git a/mmdet/models/losses/utils.py b/mmdet/models/losses/utils.py index 5c16e06256187f9e59f073c8e8980adedddfa9ec..3361c6cad198e8b8e47173bf033b58c894eda106 100644 --- a/mmdet/models/losses/utils.py +++ b/mmdet/models/losses/utils.py @@ -64,6 +64,7 @@ def weighted_loss(loss_func): :Example: + >>> import torch >>> @weighted_loss >>> def l1_loss(pred, target): >>> return (pred - target).abs() diff --git a/mmdet/models/mask_heads/fused_semantic_head.py b/mmdet/models/mask_heads/fused_semantic_head.py index ee6910f48d7512f2149e97809390a19b654d3c79..80dab051632c3cf46d7550f76959b11e530a6595 100644 --- a/mmdet/models/mask_heads/fused_semantic_head.py +++ b/mmdet/models/mask_heads/fused_semantic_head.py @@ -9,7 +9,7 @@ from ..utils import ConvModule @HEADS.register_module class FusedSemanticHead(nn.Module): - """Multi-level fused semantic segmentation head. + r"""Multi-level fused semantic segmentation head. in_1 -> 1x1 conv --- | diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000000000000000000000000000000000000..9796e871e70c7c67345b1d6bcf708c0c82377a98 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,7 @@ +[pytest] +addopts = --xdoctest --xdoctest-style=auto +norecursedirs = .git ignore build __pycache__ data docker docs .eggs + +filterwarnings= default + ignore:.*No cfgstr given in Cacher constructor or call.*:Warning + ignore:.*Define the __nice__ method for.*:Warning diff --git a/setup.py b/setup.py index 3c8f55c7c28e03a22801d568f1cc078becc0cb15..c75f521889ae0efc32f47776e7a018809de28791 100644 --- a/setup.py +++ b/setup.py @@ -152,7 +152,7 @@ if __name__ == '__main__': ], license='Apache License 2.0', setup_requires=['pytest-runner', 'cython', 'numpy'], - tests_require=['pytest'], + tests_require=['pytest', 'xdoctest'], install_requires=get_requirements(), ext_modules=[ make_cython_ext( diff --git a/tests/requirements.txt b/tests/requirements.txt index 4eced7995e77c429dfdc489483e17da24afcdefc..a1f3efbbe93d05ef4e1eceeb8d5640b56daf1d3e 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -2,4 +2,5 @@ isort flake8 yapf pytest-cov -codecov \ No newline at end of file +codecov +xdoctest >= 0.10.0