Yelp / MOE

A global, black box optimization engine for real world metric optimization.
Other
1.31k stars 139 forks source link

[Python] parameterize tests where appropriate #410

Open suntzu86 opened 9 years ago

suntzu86 commented 9 years ago

pytest allows us to parameterize tests: http://pytest.org/latest/example/parametrize.html

Many tests (e.g., moe/tests/optimal_learning/python/cpp_wrappers/gaussian_process_test.py::TestGaussianProcess::test_python_and_cpp_return_same_mu_and_gradient or moe/tests/views/exceptions_test.py::TestRestGaussianProcessWithExceptions::test_badly_formed_json_payload_invalid) loop over multiple different inputs to essentially the same test (and often other tests in the file share a similar structure). It'd be shorter/cleaner to use parameterization.