pytorch/caffe2/python/operator_test/conftest.py
Ansha Yu e3e6ca1102 operator serialized test coverage summary document (#13703)
Summary:
Add a markdown document summarizing the coverage of serialized operator tests. This currently only takes into account what has been covered by the tests with respect to the entire registry of c2 operators.

Next, we will break down the coverage by which operators have unit tests associated with them, which have hypothesis tests, and which have tests more specifically calling assertReferenceChecks.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13703

Reviewed By: dzhulgakov

Differential Revision: D12970810

Pulled By: ajyu

fbshipit-source-id: 4f0cd057b1cf734371333e24d26cbab630a170e1
2018-11-09 15:04:08 -08:00

49 lines
1.6 KiB
Python

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import caffe2.python.serialized_test.serialized_test_util as serial
def pytest_addoption(parser):
parser.addoption(
'-G',
'--generate-serialized',
action='store_true',
dest='generate',
help='generate output files (default=false, compares to current files)',
)
parser.addoption(
'-O',
'--output',
default=serial.DATA_DIR,
dest='output',
help='output directory (default: %(default)s)'
)
parser.addoption(
'-D',
'--disable-serialized-check',
action='store_true',
dest='disable',
help='disable checking serialized tests'
)
parser.addoption(
'-C',
'--disable-gen-coverage',
action='store_true',
dest='disable_coverage',
help='disable generating coverage markdown file'
)
def pytest_configure(config):
generate = config.getoption('generate', default=False)
output = config.getoption('output', default=serial.DATA_DIR)
disable = config.getoption('disable', default=False)
disable_coverage = config.getoption('disable_coverage', default=False)
serial._output_context.__setattr__('should_generate_output', generate)
serial._output_context.__setattr__('output_dir', output)
serial._output_context.__setattr__('disable_serialized_check', disable)
serial._output_context.__setattr__('disable_gen_coverage', disable_coverage)