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

Pytest Style: test_streamio.py #1472

Merged
merged 6 commits into from Jul 20, 2017
Merged

Conversation

utkbansal
Copy link
Member

Fixes #

Changes made in this Pull Request:

PR Checklist

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

@utkbansal
Copy link
Member Author

@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"):
Copy link
Contributor

Choose a reason for hiding this comment

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

path should likely be tmpdir

Copy link
Member Author

Choose a reason for hiding this comment

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

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

This is it.

Copy link
Member Author

Choose a reason for hiding this comment

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

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Member

Choose a reason for hiding this comment

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

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

@utkbansal
Copy link
Member Author

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

@jbarnoud
Copy link
Contributor

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be replaced.

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Contributor

Choose a reason for hiding this comment

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

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",
Copy link
Member

Choose a reason for hiding this comment

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

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__

Copy link
Member

@kain88-de kain88-de left a comment

Choose a reason for hiding this comment

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

@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]')
Copy link
Member

Choose a reason for hiding this comment

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

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)
Copy link
Member

Choose a reason for hiding this comment

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

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

@kain88-de
Copy link
Member

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

@kain88-de
Copy link
Member

There is one comment left from @richardjgowers

@kain88-de kain88-de merged commit 51ce987 into MDAnalysis:develop Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants