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

Pytest Style: test_streamio.py #1472

Merged
merged 6 commits into from Jul 20, 2017

Conversation

Projects
None yet
5 participants
@utkbansal
Member

utkbansal commented Jul 10, 2017

Fixes #

Changes made in this Pull Request:

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

@orbeckst orbeckst added the testing label Jul 11, 2017

@utkbansal

This comment has been minimized.

Member

utkbansal commented Jul 12, 2017

@richardjgowers @kain88-de @jbarnoud Please have a close look at the yield based that I converted.

err_msg=("os.path.{0}() does not work with "
"NamedStream").format(funcname))
def test_join(self, funcname="join", path="/tmp/MDAnalysisTests"):

This comment has been minimized.

@jbarnoud

jbarnoud Jul 12, 2017

Contributor

path should likely be tmpdir

This comment has been minimized.

@utkbansal

utkbansal Jul 12, 2017

Member

I do not know why "join" is treated separately, but I do not see it in your version.

This is it.

This comment has been minimized.

@utkbansal

utkbansal Jul 12, 2017

Member

We were sending this function "join" explicitly, but the same value is already there as the default parameter, so I skipped adding a parametrize call.

"NamedStream").format(funcname))
for func in funcs:
yield _test_func, func
yield _test_join, "join"

This comment has been minimized.

@jbarnoud

jbarnoud Jul 12, 2017

Contributor

I do not know why "join" is treated separately, but I do not see it in your version.

This comment has been minimized.

@richardjgowers

richardjgowers Jul 14, 2017

Member

it's test_join in the new version, so test_ospath_funcs has been split in two in the new version

@utkbansal

This comment has been minimized.

Member

utkbansal commented Jul 12, 2017

@jbarnoud Updated to use tmpdir. Should be good now.

@jbarnoud

This comment has been minimized.

Contributor

jbarnoud commented Jul 13, 2017

Travis fails with the old numpy:

=================================== FAILURES ===================================

____________________ MDAnalysisTests/utils/test_streamio.py ____________________

[gw0] linux2 -- Python 2.7.13 /home/travis/miniconda/envs/test/bin/python

Slave 'gw0' crashed while running 'MDAnalysisTests/utils/test_streamio.py::TestNamedStream_filename_behavior::()::test_expanduser_noexpansion_returns_NamedStream'

____________________ MDAnalysisTests/utils/test_streamio.py ____________________

[gw2] linux2 -- Python 2.7.13 /home/travis/miniconda/envs/test/bin/python

Slave 'gw2' crashed while running 'MDAnalysisTests/utils/test_streamio.py::TestNamedStream_filename_behavior::()::test_expandvars'

____________________ MDAnalysisTests/utils/test_streamio.py ____________________

[gw3] linux2 -- Python 2.7.13 /home/travis/miniconda/envs/test/bin/python

Slave 'gw3' crashed while running 'MDAnalysisTests/utils/test_streamio.py::TestNamedStream_filename_behavior::()::test_expandvars_noexpansion_returns_NamedStream'

============== 3 failed, 5123 passed, 1 skipped in 560.61 seconds =============

It seems that test_expandvars_noexpansion_returns_NamedStream, test_expanduser_noexpansion_returns_NamedStream, and test_expandvars are not skipped as they should.

yield _test_join, "join"
# Segmentation fault when run as a test on Mac OS X 10.6, Py 2.7.11 [orbeckst]
@dec.skipif(True)

This comment has been minimized.

@jbarnoud

jbarnoud Jul 13, 2017

Contributor

Should be replaced.

# expandvars(NamedStream) does not work interactively, so it is a knownfailure
# Segmentation fault when run as a test on Mac OS X 10.6, Py 2.7.11 [orbeckst]
@dec.skipif(True)
@dec.skipif("HOME" not in os.environ)

This comment has been minimized.

@jbarnoud

jbarnoud Jul 13, 2017

Contributor

Both skips should be replaced.

@@ -226,8 +225,6 @@ def test_expandvars(self):
assert_equal(value, reference,
err_msg="os.path.expandvars() did not expand HOME")
# Segmentation fault when run as a test on Mac OS X 10.6, Py 2.7.11 [orbeckst]
@dec.skipif(True)

This comment has been minimized.

@jbarnoud

jbarnoud Jul 13, 2017

Contributor

Should be replaced.

This comment has been minimized.

@jbarnoud

jbarnoud Jul 13, 2017

Contributor

You can open an issue with the output of the 'old numpy' build and the comment of @orbeckst, then refer to the issue as a reason for the skip.

This comment has been minimized.

@utkbansal

This comment has been minimized.

@jbarnoud

jbarnoud Jul 13, 2017

Contributor

I would prefer an issue rather than just copying the comment as you did. Since travis broke on linux with the old numpy, the comment is obviously missing part of the problem.

This comment has been minimized.

@kain88-de

kain88-de Jul 16, 2017

Member

here as well what happens on travis if you remove the skip it

This comment has been minimized.

@jbarnoud

jbarnoud Jul 16, 2017

Contributor

The "old numpy" build was failing with the pytest worker was failing in a way reminiscent to a segmentation fault. Hence my insistence on having an issue opened.

ns = self.create_NamedStream()
@pytest.mark.parametrize('funcname', (
"abspath",

This comment has been minimized.

@richardjgowers

richardjgowers Jul 14, 2017

Member

Can't we just give the functions as the parameters here? Ie pass a list of the actual functions rather than the name of the function. Then for the error message just do func.__name__

@dec.skipif(True)
@dec.skipif("HOME" not in os.environ)
@knownfailure
@pytest.mark.skipif(True, reason='Segmentation fault when run as a test on Mac OS X 10.6, Py 2.7.11 [orbeckst]')

This comment has been minimized.

@kain88-de

kain88-de Jul 16, 2017

Member

does this fail on travis when you remove this line? The comment refers to a 6 year old OS.

@@ -226,8 +225,6 @@ def test_expandvars(self):
assert_equal(value, reference,
err_msg="os.path.expandvars() did not expand HOME")
# Segmentation fault when run as a test on Mac OS X 10.6, Py 2.7.11 [orbeckst]
@dec.skipif(True)

This comment has been minimized.

@kain88-de

kain88-de Jul 16, 2017

Member

here as well what happens on travis if you remove the skip it

@kain88-de

This comment has been minimized.

Member

kain88-de commented Jul 18, 2017

@utkbansal I think you need to rebase this now against develop.

utkbansal added some commits Jul 10, 2017

@kain88-de

This comment has been minimized.

Member

kain88-de commented Jul 19, 2017

There is one comment left from @richardjgowers

@kain88-de kain88-de merged commit 51ce987 into MDAnalysis:develop Jul 20, 2017

3 checks passed

QuantifiedCode No new issues introduced.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.02%) to 90.439%
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment