Files
Zhengxing Chen 810646511f import torchrec properly
Summary:
To avoid test failures caused by importing torchrec, i finally decide the following import rules:
For gpu machines, import torchrec (gpu, stable version)
For cpu machines, import torchrec-nightly-cpu

Reviewed By: speedystream

Differential Revision: D38185498

fbshipit-source-id: 7988695f827cfd04d53f6d63630ac843eb6c23ee
2022-07-27 09:40:32 -07:00

133 lines
4.1 KiB
INI

# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.
# This post discusses how to specify patterns for testing specific tests
# https://stackoverflow.com/questions/36456920/is-there-a-way-to-specify-which-pytest-tests-to-run-from-a-file
[tox]
envlist = py38
[pytest]
addopts = --verbose -d --tx popen --cov=reagent --cov-report=xml --cov-append --junitxml={envlogdir}/junit-{envname}.xml
# Refer to https://docs.pytest.org/en/stable/example/markers.html
# for how we include/exclude tests in pytest
[testenv]
# Install the latest pip, setuptools, wheel; this is needed for downloading opencv-python wheel,
# instead of building from source (which is super slow).
download = true
extras =
gym
test
torchrec_cpu
install_command =
pip install --pre --extra-index-url https://download.pytorch.org/whl/cpu -f https://download.pytorch.org/whl/nightly/torchrec_nightly_cpu/ {opts} {packages} --progress-bar off
commands =
pytest -n2 -m "(not serial) and (not seq2slate_long)"
pytest -n0 -m "serial"
# install CUDA 11.3 Torch
[ubuntu_gpu]
extras =
gym
test
torchrec_gpu
install_command =
pip install --pre --extra-index-url https://download.pytorch.org/whl/cu113 -f https://download.pytorch.org/whl/torchrec/ {opts} {packages} --progress-bar off
[testenv:circleci_misc_unittest]
install_command = {[ubuntu_gpu]install_command}
extras = {[ubuntu_gpu]extras}
commands =
pytest reagent/test -n2 -m "not serial" --ignore=reagent/test/mab/ --ignore=reagent/test/lite/ --ignore=reagent/test/ranking/ --ignore=reagent/test/training/ --ignore=reagent/test/prediction/ --ignore=reagent/test/world_model/
pytest reagent/test -n0 -m "serial" --ignore=reagent/test/mab/ --ignore=reagent/test/lite/ --ignore=reagent/test/ranking/ --ignore=reagent/test/training/ --ignore=reagent/test/prediction/ --ignore=reagent/test/world_model/
[testenv:circleci_gym_replay_buffer_1_cpu_unittest]
commands =
pytest reagent/gym/tests -n2 -m "not serial" -k "test_replay_buffer_gym_cpu_1"
[testenv:circleci_gym_replay_buffer_2_cpu_unittest]
commands =
pytest reagent/gym/tests -n2 -m "not serial" -k "test_replay_buffer_gym_cpu_2"
# all cpu tests in reagent/gym/tests except test_replay_buffer_gym_cpu_x
[testenv:circleci_gym_cpu_unittest]
commands =
pytest reagent/gym/tests -n2 -m "not serial" -k "not test_replay_buffer_gym_cpu"
[testenv:circleci_gym_replay_buffer_1_gpu_unittest]
install_command = {[ubuntu_gpu]install_command}
extras = {[ubuntu_gpu]extras}
commands =
pytest reagent/gym/tests -n0 -m "serial" -k "test_replay_buffer_gym_gpu_1"
[testenv:circleci_gym_replay_buffer_2_gpu_unittest]
install_command = {[ubuntu_gpu]install_command}
extras = {[ubuntu_gpu]extras}
commands =
pytest reagent/gym/tests -n0 -m "serial" -k "test_replay_buffer_gym_gpu_2"
# all gpu tests in reagent/gym/tests except test_replay_buffer_gym_gpu_x
[testenv:circleci_gym_gpu_unittest]
install_command = {[ubuntu_gpu]install_command}
extras = {[ubuntu_gpu]extras}
commands =
pytest reagent/gym/tests -n0 -m "serial" -k "not test_replay_buffer_gym_gpu"
[testenv:circleci_ranking_unittest]
install_command = {[ubuntu_gpu]install_command}
extras = {[ubuntu_gpu]extras}
commands =
pytest reagent/test/ranking -n2
[testenv:circleci_training_unittest]
install_command = {[ubuntu_gpu]install_command}
extras = {[ubuntu_gpu]extras}
commands =
pytest reagent/test/training -n2
[testenv:circleci_prediction_unittest]
install_command = {[ubuntu_gpu]install_command}
extras = {[ubuntu_gpu]extras}
commands =
pytest reagent/test/prediction -n2
[testenv:circleci_world_model_unittest]
install_command = {[ubuntu_gpu]install_command}
extras = {[ubuntu_gpu]extras}
commands =
pytest reagent/test/world_model -n2
[testenv:circleci_lite_api_unittest]
extras =
lite
test
commands =
pytest reagent/test/lite -n2
pytest --doctest-modules reagent/lite -n2 --doctest-continue-on-failure
[testenv:circleci_mab_unittest]
extras =
test
commands =
pytest reagent/test/mab -n2