openprov / interop-test-harness

Interoperability test harness for the Southampton Provenance Suite.
MIT License
1 stars 2 forks source link

Improve Sphinx workaround in prov_interop.interop_tests.test_converter #5

Open mikej888 opened 9 years ago

mikej888 commented 9 years ago

The ConverterTestCase class has a method:

def initialise_test_harness()

which initialises the test harness and provide the test cases as a generator. This is called back from:

@parameterized.expand(initialise_test_harness(), testcase_func_name=test_case_name)
def test_case(self, index, ext_in, file_ext_in, ext_out, file_ext_out)

and is used to provide the test cases so that nose-parameterized can auto-generate one test method per test case.If running Sphinx to create API documentation then the test harness initialisation is not done and, instead, a generator that contains zero test cases is returned. This is a hack to workaround Sphinx's execution of the Python it parses. Sphinx is detected if sys.argv[0] (the current command) contains the text sphinx-build.

If this is not done, then Sphinx documentation generation fails for this class and sub-classes as it tries to initialise the test harness.

Perhaps a less hacky solution can be adopted. I tried setting the environment variable, PROV_HARNESS_CONFIGURATION to point to a simple harness.yml file which points to a directory with no test cases, but getting the environment variable through Make and Sphinx proved problematic and would have needed the introduction of another shell script, which seemed like overengineering.