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

testing: fixed an issue with the handling of tempdirs #866

Merged
merged 6 commits into from
Jul 24, 2018

Conversation

notestaff
Copy link
Contributor

Fixed an issue with the handling of temporary directories during testing, caused by an interaction of a legacy unittest-based class with the newer pytest-based fixtures.

@notestaff
Copy link
Contributor Author

This PR adds a fix for #862

@notestaff
Copy link
Contributor Author

Btw, integration/test_ncbi.py uses class-scope tempdirs rather than function-scope ones. Is it necessary for tests in each test class there to share a tempdir?

@notestaff
Copy link
Contributor Author

@tomkinsc
Copy link
Member

The tempdirs would ideally be function-scoped. With the changes from this PR applied that appears to be true for tempfile.gettempdir()?

@notestaff
Copy link
Contributor Author

That's true. I just want to check that it was not important for them to be class-scoped, as they were originally.

@@ -20,7 +20,7 @@
log = logging.getLogger(__name__)


skip_test = True
skip_test = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests were mostly disabled because instability in the NCBI API due to load frequently causes the tests to fail, even with the retries in genbank.py. Enabling them was mostly to illustrate the tempdir issue, so we can probably switch them off again.

class TestCaseWithTmp(unittest.TestCase):
'Base class for tests that use tempDir'

@classmethod
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removal fixes the issue I was having, but does it break unittest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomkinsc What mode of breakage are you thinking about? Can you maybe add a test to test for it? Current test suite doesn't seem to break.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incompatibility when testing under the built-in unittest module, which I suppose we don't need to worry about if we're going all-in on pytest.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomkinsc I've been adding tests to the test suite that are pytest-based only, which would not be run if pytest is not used. Is there a goal of keeping the test suite runnable without pytest?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we've talked about it(?). @dpark01 @yesimon @haydenm, what are your thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm for moving to pytest

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I think we had it all set up to be backwards compatible with unittest. But I think we've already crossed the bridge to being pytest-dependent. A fair amount of the metagenomics tests are not unittest compatible. Anyway I wouldn't worry about it at this point...

@tomkinsc tomkinsc merged commit e2515d3 into master Jul 24, 2018
@tomkinsc tomkinsc deleted the is-fix-test-tempfiles branch July 24, 2018 23:10
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

Successfully merging this pull request may close these issues.

4 participants