Skip to content

TST: Mark check for f2py script xfail. #12033

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

Merged
merged 3 commits into from
Sep 25, 2018
Merged

Conversation

EricSchles
Copy link

Context:

When running the tests via python [ROOT DIR]/runtests.py on windows linux subsystem a test fails with respect to f2py, f2py3, f2py3.6.

This is despite the fact that f2py exists in the my path, however I don't have f2py3 or f2py3.6 which shouldn't be required for the tests to pass.

closes gh-10016

if all_success == 3:
return
elif f2py_success == 1:
msg = "f2py fails"
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look right.

Copy link
Member

Choose a reason for hiding this comment

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

And the warning will raise an error in the development branch.

Copy link
Member

Choose a reason for hiding this comment

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

There is something special about the windows linux subsystem as this test passes on appveyor. I don't know how to check for the linux subsystem, so it would be better to simply check for f2py, or maybe for the presence of at least one of the options, which is what the test used to do.

Copy link
Member

Choose a reason for hiding this comment

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

@charris it fails on multiple other systems, see gh-10016

I think this test does need to be simplified. The logic here is that if all 3 commands are not found, it checks just for f2py and if that is found then the test does not fail. I think that's the main thing to agree on first. The rest can be tweaked as needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

This test always fails for me on both WSL and Mac; mac also always fails test_sdot_bug_8577 in my hands. My development workflow is often to establish the baseline failure count expected for the full suite before running tests on a new feature branch.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, I think just checking for f2py is the way to go. That used to fail for other systems also, but maybe it is better now that we are using entry points. @tylerjereddy Does that simplified test work for you?

Copy link
Contributor

Choose a reason for hiding this comment

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

On my mac with this diff on master:

--- a/numpy/tests/test_scripts.py
+++ b/numpy/tests/test_scripts.py
@@ -92,7 +92,7 @@ def test_f2py():
         version = sys.version_info
         major = str(version.major)
         minor = str(version.minor)
-        f2py_cmds = ('f2py', 'f2py' + major, 'f2py' + major + '.' + minor)
+        f2py_cmds = ('f2py',)
         success = try_f2py_commands(f2py_cmds)
-        msg = "Warning: not all of %s, %s, and %s are found in path" % f2py_cmds
-        assert_(success == 3, msg)
+        msg = "Warning: %s not found in path" % f2py_cmds
+        assert_(success == 1, msg)

From python runtests.py -t "numpy/tests/test_scripts.py" -- -s I get a failure and f2py itself gives:

Traceback (most recent call last):
  File "/Users/treddy/miniconda3/envs/numpy_dev_py36/bin/f2py", line 11, in <module>
    load_entry_point('numpy==1.16.0.dev0+025bbdd', 'console_scripts', 'f2py')()
  File "/Users/treddy/miniconda3/envs/mda_dev_py3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 565, in load_entry_point
  File "/Users/treddy/miniconda3/envs/mda_dev_py3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 2598, in load_entry_point
  File "/Users/treddy/miniconda3/envs/mda_dev_py3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 2258, in load
  File "/Users/treddy/miniconda3/envs/mda_dev_py3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 2264, in resolve
  File "/Users/treddy/.local/lib/python3.6/site-packages/numpy-1.16.0.dev0+5f2a5ae-py3.6-macosx-10.9-x86_64.egg/numpy/f2py/__main__.py", line 4, in <module>
    from f2py2e import main
ModuleNotFoundError: No module named 'f2py2e'

The modified test and f2py itself can be made to work if I adjust my path on mac os to check the build path first, before site-packages, with:
export PATH=/Users/treddy/github_projects/numpy_linked_worktree/build/testenv/bin:$PATH
I did something similar to get shippable builds all green.

Once the path search order was fixed, I went back and reversed the change to the unit test noted above and the original test passed on my mac, so...

I'm pretty sure @pv previously commented somewhere about the difficulty of getting the f2py path stuff working just right in a portable fashion.

@EricSchles
Copy link
Author

EricSchles commented Sep 25, 2018 via email

@charris
Copy link
Member

charris commented Sep 25, 2018

Is there any case that we care about all three?

They are all supposed to show up somewhere, but only non-windows systems. Out of curiosity, what does sys.platform return on WSL? I wonder what is happening on the Mac? In setup.py there is

    # The f2py scripts that will be installed
    if sys.platform == 'win32':
        f2py_cmds = [
            'f2py = numpy.f2py.f2py2e:main',
            ]
    else:
        f2py_cmds = [
            'f2py = numpy.f2py.f2py2e:main',
            'f2py%s = numpy.f2py.f2py2e:main' % sys.version_info[:1],
            'f2py%s.%s = numpy.f2py.f2py2e:main' % sys.version_info[:2],
            ]

In any case, we are leaving the placement of those commands up to distutils. @tylerjereddy Does the mac detect any of those? What does which f2py report?

@charris
Copy link
Member

charris commented Sep 25, 2018

Let's just mark the existing test as xfail. That will provide some interesting information while not causing annoying test failures. We really cannot do much more, and if someone cannot run f2py we can deal with that when they complain.

@tylerjereddy
Copy link
Contributor

@charris Yeah, seems tricky with the PATH setting apparently platform-specific; for the Ubuntu thing in shippable I had to do this to set it dynamically to find f2py:

    - extra_directories=($SHIPPABLE_REPO_DIR/build/*scripts*)
    - extra_path=$(printf "%s:" "${extra_directories[@]}")
    - export PATH="${extra_path}${PATH}"

@EricSchles
Copy link
Author

EricSchles commented Sep 25, 2018 via email

@charris
Copy link
Member

charris commented Sep 25, 2018

@EricSchles Let's leave the test alone, but add an @pytest.mark.xfail(reason="Test is unreliable") decorator.

@EricSchles
Copy link
Author

EricSchles commented Sep 25, 2018 via email

@EricSchles
Copy link
Author

Alright, changes removed @charris should I rebase my changes so only the one code change is reflected? Or is it fine to leave as is?

@charris
Copy link
Member

charris commented Sep 25, 2018

A rebase would be nice.

@charris charris merged commit 66dcb03 into numpy:master Sep 25, 2018
@charris
Copy link
Member

charris commented Sep 25, 2018

Well, a rebase with squashing the commits :) But good enough. Thanks @EricSchles .

@charris charris changed the title TST: updating f2py to ensure that at least f2py base exists, and doesn't e… TST: Mark check for f2py script xfail. Sep 25, 2018
@rgommers
Copy link
Member

👍 first commit, keep them coming @EricSchles!

@EricSchles
Copy link
Author

EricSchles commented Sep 25, 2018 via email

@charris
Copy link
Member

charris commented Sep 25, 2018

@EricSchles No problem.

@EricSchles
Copy link
Author

EricSchles commented Sep 25, 2018 via email

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

Successfully merging this pull request may close these issues.

BUG: runtest.py always fails tests_scripts.text_f2py on windows
4 participants