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

Add missing dependency on boutdata #118

Closed
wants to merge 1 commit into from
Closed

Conversation

dschwoerer
Copy link
Contributor

The tests fail as they require boutdata

Full output:

reading manifest file 'xBOUT.egg-info/SOURCES.txt'
writing manifest file 'xBOUT.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 67, in <module>
    'source_dir': ('setup.py', 'docs'),
  File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib64/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.7/site-packages/setuptools/command/test.py", line 237, in run
    self.run_tests()
  File "/usr/lib/python3.7/site-packages/setuptools/command/test.py", line 259, in run_tests
    exit=False,
  File "/usr/lib64/python3.7/unittest/main.py", line 100, in __init__
    self.parseArgs(argv)
  File "/usr/lib64/python3.7/unittest/main.py", line 124, in parseArgs
    self._do_discovery(argv[2:])
  File "/usr/lib64/python3.7/unittest/main.py", line 244, in _do_discovery
    self.createTests(from_discovery=True, Loader=Loader)
  File "/usr/lib64/python3.7/unittest/main.py", line 154, in createTests
    self.test = loader.discover(self.start, self.pattern, self.top)
  File "/usr/lib64/python3.7/unittest/loader.py", line 349, in discover
    tests = list(self._find_tests(start_dir, pattern))
  File "/usr/lib64/python3.7/unittest/loader.py", line 406, in _find_tests
    full_path, pattern, namespace)
  File "/usr/lib64/python3.7/unittest/loader.py", line 483, in _find_test_path
    tests = self.loadTestsFromModule(package, pattern=pattern)
  File "/usr/lib/python3.7/site-packages/setuptools/command/test.py", line 55, in loadTestsFromModule
    tests.append(self.loadTestsFromName(submodule))
  File "/usr/lib64/python3.7/unittest/loader.py", line 191, in loadTestsFromName
    return self.loadTestsFromModule(obj)
  File "/usr/lib/python3.7/site-packages/setuptools/command/test.py", line 55, in loadTestsFromModule
    tests.append(self.loadTestsFromName(submodule))
  File "/usr/lib64/python3.7/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/xBOUT-master/xbout/tests/test_against_collect.py", line 8, in <module>
    boutdata = pytest.importorskip("boutdata", reason="boutdata is not available")
  File "/xBOUT-master/.eggs/pytest-5.4.1-py3.7.egg/_pytest/outcomes.py", line 214, in importorskip
    raise Skipped(reason, allow_module_level=True) from None
Skipped: boutdata is not available

the tests fail as they require `boutdata`
@johnomotani
Copy link
Collaborator

boutdata is only used in test_against_collect.py, and is intended to be optional - those tests should be skipped if boutdata is not available. Your error seems to be Skipped: boutdata is not available but I don't understand why skipped tests should be an error?

@johnomotani
Copy link
Collaborator

I guess your output is from python setup.py test? But note that setup.py test is going to be deprecated pytest-dev/pytest#5534. The tests were written to be run by running pytest in the top-level directory (or subdirectories to run any tests under that subdirectory). I think we're following current best practice as described here https://docs.pytest.org/en/latest/goodpractices.html#integrating-with-setuptools-python-setup-py-test-pytest-runner, but do make an issue/PR if you find something missing!

@dschwoerer
Copy link
Contributor Author

After checking again, it fails. not sure what the error is:

[...]
    module = __import__(module_name)
  File "/xBOUT-master/xbout/tests/test_against_collect.py", line 8, in <module>
    boutdata = pytest.importorskip("boutdata", reason="boutdata is not available")
  File "/usr/lib/python3.8/site-packages/_pytest/outcomes.py", line 175, in importorskip
    raise Skipped(reason, allow_module_level=True)
Skipped: boutdata is not available
[root@9e8ae4eb9a6b xBOUT-master]# echo $?
1

No clue why that is an error, but it is failing as is.

With the new dependency, it is not failing, and doing nothing:

[root@9e8ae4eb9a6b xBOUT-master]# python3 setup.py test
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
writing xBOUT.egg-info/PKG-INFO
writing dependency_links to xBOUT.egg-info/dependency_links.txt
writing requirements to xBOUT.egg-info/requires.txt
writing top-level names to xBOUT.egg-info/top_level.txt
package init file 'xbout/calc/tests/__init__.py' not found (or not a regular file)
reading manifest file 'xBOUT.egg-info/SOURCES.txt'
writing manifest file 'xBOUT.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
[root@9e8ae4eb9a6b xBOUT-master]# echo $?
0

Are the test_requires also used by tox?

@johnomotani
Copy link
Collaborator

I haven't looked at tox. From looking at some old versions of the pytest docs that did talk about setup.py integration, there was extra stuff needed to run pytest from there, so I think python setup.py test is expected to fail. Recommendation is just run pytest - is there any reason that's a problem?

@TomNicholas
Copy link
Collaborator

We shouldn't add boutdata as an explicit dependency because it isn't a dependency.

tox should just run pytest if you tell it to right? Not sure why that fails when bare pytest is fine - how exactly are you running the tests?

@dschwoerer
Copy link
Contributor Author

I have used python3 setup.py test.

I thought I should at least not be doing anything, but I guess that isn't as easy as I though -.-

@dschwoerer dschwoerer closed this Apr 22, 2020
@dschwoerer dschwoerer deleted the dschwoerer-patch-1 branch April 22, 2020 15:25
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.

None yet

3 participants