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

py.test fixture used in #1633 causes problems #1660

Closed
ctb opened this issue Mar 19, 2017 · 2 comments
Closed

py.test fixture used in #1633 causes problems #1660

ctb opened this issue Mar 19, 2017 · 2 comments
Labels

Comments

@ctb
Copy link
Member

ctb commented Mar 19, 2017

So @betatim introduced this:

    @pytest.fixture
    def reads():
        infile = utils.get_test_data('valid-read-testing.fq')
        reads = ReadParser(infile)
        yield reads
        reads.close()

which causes problems on my mac, which is using pytest 2.9.1:

/Users/t/dev/khmer/tests/test_sequence_validation.py:70
____ ERROR at setup of test_read_cleaning_trim_functions_bad_dna[Nodegraph] ____
pytest.fixture functions cannot use ``yield``. Instead write and return an inner function/generator and let the consumer call and iterate over it.:

I have switched to using a try/finally; this issue is here to tell @betatim why.

@ctb
Copy link
Member Author

ctb commented Mar 19, 2017

ref #1633

@ctb ctb added the wontfix label Mar 19, 2017
@ctb ctb closed this as completed Mar 19, 2017
@betatim
Copy link
Member

betatim commented Mar 20, 2017

Oups! I'm on py.test 3 already. In 2.9 it should be @pytest.yield_fixture http://doc.pytest.org/en/2.9.2/fixture.html#fixture-finalization-executing-teardown-code

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

No branches or pull requests

2 participants