Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests broken by pytest 3.5.0 #6

Closed
dotlambda opened this issue Apr 6, 2018 · 5 comments
Closed

Tests broken by pytest 3.5.0 #6

dotlambda opened this issue Apr 6, 2018 · 5 comments

Comments

@dotlambda
Copy link

Since upgrading pytest from 3.4.2 to 3.5.0, sybil's testsuite fails:

============================= test session starts ==============================
platform linux2 -- Python 2.7.14, pytest-3.5.0, py-1.5.3, pluggy-0.6.0 -- /nix/store/ivdcnkynqa01bq6n1srwi1kpjnawifkd-python-2.7.14/bin/python2.7
cachedir: .pytest_cache
rootdir: /build/sybil-1.0.7, inifile: setup.cfg
collecting ... collected 36 items

tests/test_capture.py::test_basic PASSED                                 [  2%]
tests/test_capture.py::test_directive_indent_beyond_block PASSED         [  5%]
tests/test_capture.py::test_directive_indent_equal_to_block PASSED       [  8%]
tests/test_codeblock.py::test_basic PASSED                               [ 11%]
tests/test_codeblock.py::test_future_imports PASSED                      [ 13%]
tests/test_doc_example.py::test_pytest PASSED                            [ 16%]
tests/test_doc_example.py::test_unittest PASSED                          [ 19%]
tests/test_doc_example.py::test_nose PASSED                              [ 22%]
tests/test_doctest.py::test_pass PASSED                                  [ 25%]
tests/test_doctest.py::test_fail PASSED                                  [ 27%]
tests/test_doctest.py::test_fail_with_options PASSED                     [ 30%]
tests/test_doctest.py::test_literals PASSED                              [ 33%]
tests/test_doctest.py::test_min_indent PASSED                            [ 36%]
tests/test_doctest.py::test_tabs PASSED                                  [ 38%]
tests/test_functional.py::test_pytest FAILED                             [ 41%]
tests/test_functional.py::test_unittest PASSED                           [ 44%]
tests/test_functional.py::test_nose PASSED                               [ 47%]
tests/test_sybil.py::TestRegion::test_repr PASSED                        [ 50%]
tests/test_sybil.py::TestExample::test_repr PASSED                       [ 52%]
tests/test_sybil.py::TestExample::test_evaluate_okay PASSED              [ 55%]
tests/test_sybil.py::TestExample::test_evaluate_not_okay PASSED          [ 58%]
tests/test_sybil.py::TestExample::test_evaluate_raises_exception PASSED  [ 61%]
tests/test_sybil.py::TestDocument::test_add PASSED                       [ 63%]
tests/test_sybil.py::TestDocument::test_add_no_overlap PASSED            [ 66%]
tests/test_sybil.py::TestDocument::test_add_out_of_order PASSED          [ 69%]
tests/test_sybil.py::TestDocument::test_add_adjacent PASSED              [ 72%]
tests/test_sybil.py::TestDocument::test_add_before_start PASSED          [ 75%]
tests/test_sybil.py::TestDocument::test_add_after_end PASSED             [ 77%]
tests/test_sybil.py::TestDocument::test_add_overlaps_with_previous PASSED [ 80%]
tests/test_sybil.py::TestDocument::test_add_overlaps_with_next PASSED    [ 83%]
tests/test_sybil.py::TestDocument::test_example_path PASSED              [ 86%]
tests/test_sybil.py::TestDocument::test_example_line_and_column PASSED   [ 88%]
tests/test_sybil.py::TestSybil::test_parse PASSED                        [ 91%]
tests/test_sybil.py::TestSybil::test_all_paths PASSED                    [ 94%]
tests/test_sybil.py::TestSybil::test_all_paths_with_base_directory PASSED [ 97%]
tests/test_sybil.py::test_namespace PASSED                               [100%]

=================================== FAILURES ===================================
_________________________________ test_pytest __________________________________

capsys = <_pytest.capture.CaptureFixture object at 0x7ffff1f9d7d0>

    def test_pytest(capsys):

        class CollectResults:
            def pytest_sessionfinish(self, session):
                self.session = session

        results = CollectResults()
        return_code = pytest_main(['-vs', join(functional_test_dir, 'pytest')],
                                  plugins=[results])
        assert return_code == 1
        assert results.session.testsfailed == 4
        assert results.session.testscollected == 10

        out, err = capsys.readouterr()
        # check we're trimming tracebacks:
        index = out.find('sybil/example.py')
        if index > -1:  # pragma: no cover
            raise AssertionError('\n'+out[index-500:index+500])

        out = Finder(out)
        out.then_find('fail.rst::line:1,column:1')
>       out.then_find('fail.rst sybil setup function_fixture setup\n'
                      'class_fixture setup\n'
                      'module_fixture setup\n'
                      'session_fixture setup\n'
                      'x is currently: 0\n'
                      'FAILED class_fixture teardown\n'
                      'function_fixture teardown')

tests/test_functional.py:44:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tests.test_functional.Finder object at 0x7ffff1ee2050>
substring = 'fail.rst sybil setup function_fixture setup\nclass_fixture setup\nmodule_fixture setup\nsession_fixture setup\nx is currently: 0\nFAILED class_fixture teardown\nfunction_fixture teardown'

    def then_find(self, substring):
>       assert substring in self.text[self.index:]
E       AssertionError: assert 'fail.rst sybil setup function_fixture setup\nclass_fixture setup\nmodule_fixture setup\nsession_fixture setup\nx is currently: 0\nFAILED class_fixture teardown\nfunction_fixture teardown' in 'fail.rst::line:1,column:1 <- /build/sybil-1.0.7/tests/functional/pytest/fail.rst sybil setup session_fixture setup\nmo...tional/pytest/fail.rst:18: Exception\n====================== 4 failed, 6 passed in 0.05 seconds ======================\n'

tests/test_functional.py:19: AssertionError
===================== 1 failed, 35 passed in 0.41 seconds ======================
@cjw296
Copy link
Member

cjw296 commented Apr 6, 2018

I think this is fixed in cfce5ca, where are you hitting this?

@dotlambda
Copy link
Author

I'm using sybil version 1.0.7 on NixOS.

@cjw296
Copy link
Member

cjw296 commented Apr 6, 2018

Can you confirm that the above rev fixes the problem?

@dotlambda
Copy link
Author

Indeed, that solves the problem. Thank you very much!
I'll apply the patch until a new version is released.

@cjw296
Copy link
Member

cjw296 commented Apr 6, 2018

https://pypi.python.org/pypi/sybil/1.0.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants