scipy / scipy_doctest

Floating-point aware doctesting
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Restructure `failure_cases` #86

Closed Sheila-nk closed 1 year ago

Sheila-nk commented 1 year ago

Good point about failure_cases. They are indeed failing, and 'old-way' tests check that they do. Would be great to restructure these so that they pass both ways.

Originally posted by @ev-br in https://github.com/ev-br/scpdt/issues/84#issuecomment-1653337023

Sheila-nk commented 1 year ago

@ev-br I am not too sure about this issue. Mainly because some test cases that you wrote already check correct behavior, which is that they fail. I wrote a test case to check correct behavior of the plugin as well by asserting that the doctests fail.

def test_failure_cases(pytester):
    file_list = [failure_cases, failure_cases_2]
    for file in file_list:
        path_str = file.__file__
        python_file = PosixPath(path_str)
        result = pytester.inline_run(python_file, "--doctest-modules")
    assert result.ret == pytest.ExitCode.TESTS_FAILED

I am not sure we need to refactor the failure_cases especially since they fail when running python -m pytest --doctest-modules which is expected anyway.

Unless I misunderstood the task.

ev-br commented 1 year ago

OK, so the failure occurs in an unsupported way of running tests. The recommended way is

$ pytest --pyargs scpdt

which runs all tests and reports success. Which is fine then.

Sheila-nk commented 1 year ago

Closing this issue since failure_cases don't need restructuring.