Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CHAINER_TEST_PAIRWISE_PARAMETERIZATION and enable it only in Travis CI #8211

Merged
merged 3 commits into from Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pfnci/hint.pbtxt
Expand Up @@ -5,6 +5,7 @@

# Slow tests take 60+ seconds.
rules { name: "chainer_tests/functions_tests/activation_tests/test_crelu.py" xdist: 4 deadline: 240 }
rules { name: "chainer_tests/functions_tests/evaluation_tests/test_accuracy.py" xdist: 4 deadline: 240 }
rules { name: "chainer_tests/functions_tests/loss_tests/test_softmax_cross_entropy.py" xdist: 8 deadline: 240 }
rules { name: "chainer_tests/functions_tests/math_tests/test_sparse_matmul.py" xdist: 4 deadline: 240 }
rules { name: "chainer_tests/functions_tests/normalization_tests/test_batch_normalization.py" xdist: 4 deadline: 240 }
Expand Down Expand Up @@ -55,7 +56,6 @@ rules { name: "chainer_tests/functions_tests/connection_tests/test_convolution_n
rules { name: "chainer_tests/functions_tests/connection_tests/test_deconvolution_2d.py" }
rules { name: "chainer_tests/functions_tests/connection_tests/test_deconvolution_nd.py" }
rules { name: "chainer_tests/functions_tests/connection_tests/test_embed_id.py" }
rules { name: "chainer_tests/functions_tests/evaluation_tests/test_accuracy.py" }
rules { name: "chainer_tests/functions_tests/loss_tests/test_contrastive.py" }
rules { name: "chainer_tests/functions_tests/loss_tests/test_negative_sampling.py" }
rules { name: "chainer_tests/functions_tests/loss_tests/test_sigmoid_cross_entropy.py" }
Expand Down
5 changes: 4 additions & 1 deletion scripts/ci/travis/steps.sh
Expand Up @@ -158,7 +158,10 @@ step_chainer_tests() {


step_chainerx_python_tests() {
pytest -rfEX "$REPO_DIR"/tests/chainerx_tests
# TODO(niboshi): Apply pairwise parameterization only selectively. See
# #8210.
env CHAINER_TEST_PAIRWISE_PARAMETERIZATION=always \
pytest -rfEX "$REPO_DIR"/tests/chainerx_tests
}


Expand Down
16 changes: 0 additions & 16 deletions tests/chainer_tests/conftest.py
@@ -1,8 +1,6 @@
import pytest

from chainer.backends import cuda
from chainer import testing
from chainer.testing import parameterized
import chainerx


Expand All @@ -13,20 +11,6 @@
pytest.mark.chainerx = pytest.mark.skip


def pytest_collection(session):
# Perform pairwise testing.
# TODO(kataoka): This is a tentative fix. Discuss its public interface.
pairwise_product_dict = parameterized._pairwise_product_dict
testing.product_dict = pairwise_product_dict
parameterized.product_dict = pairwise_product_dict


def pytest_collection_finish(session):
product_dict = parameterized._product_dict_orig
testing.product_dict = product_dict
parameterized.product_dict = product_dict


def pytest_runtest_teardown(item, nextitem):
if cuda.available:
assert cuda.cupy.cuda.runtime.getDevice() == 0
Expand Down
16 changes: 0 additions & 16 deletions tests/chainerx_tests/conftest.py
@@ -1,7 +1,5 @@
import pytest

from chainer import testing
from chainer.testing import parameterized
import chainerx.testing

from chainerx_tests import cuda_utils
Expand All @@ -11,20 +9,6 @@ def pytest_configure(config):
_register_cuda_marker(config)


def pytest_collection(session):
# Perform pairwise testing.
# TODO(kataoka): This is a tentative fix. Discuss its public interface.
pairwise_product_dict = parameterized._pairwise_product_dict
testing.product_dict = pairwise_product_dict
parameterized.product_dict = pairwise_product_dict


def pytest_collection_finish(session):
product_dict = parameterized._product_dict_orig
testing.product_dict = product_dict
parameterized.product_dict = product_dict


def pytest_runtest_setup(item):
_setup_cuda_marker(item)

Expand Down
25 changes: 25 additions & 0 deletions tests/conftest.py
@@ -0,0 +1,25 @@
import os

from chainer import testing
from chainer.testing import parameterized


_pairwise_parameterize = (
os.environ.get('CHAINER_TEST_PAIRWISE_PARAMETERIZATION', 'never'))
assert _pairwise_parameterize in ('never', 'always')


def pytest_collection(session):
# Perform pairwise testing.
# TODO(kataoka): This is a tentative fix. Discuss its public interface.
if _pairwise_parameterize == 'always':
pairwise_product_dict = parameterized._pairwise_product_dict
testing.product_dict = pairwise_product_dict
parameterized.product_dict = pairwise_product_dict


def pytest_collection_finish(session):
if _pairwise_parameterize == 'always':
product_dict = parameterized._product_dict_orig
testing.product_dict = product_dict
parameterized.product_dict = product_dict