You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usually go into setup.cfg (and I think the "new" header is [tool:pytest]).
But I think those globs are the default. My typical setup.cfg looks like this:
and add an empty file diffeqpy/tests/__init__.py.
That would include tests in the source distribution and one would then be able to execute e.g. python3.5 -m pytest --pyargs diffeqpy from anywhere on a machine with diffeqpy installed.
It should also work if it is a "development" installation (I would recommend installing via python3.5 -m pip install --user -e . or python3.5 setup.py develop --user). Alternatively one can set PYTHONPATH=/path/to/diffeqpy and run pytest from the package root.
I think I made the changes @bjodah described but tests are still coming up blank. I pushed everything to master so you can see what the current setup it (I believe it matches what you were saying there).
crackauc@crackauc2 diffeqpy]$ cd / && python3.6 -m pytest --pyargs diffeqpy
============================================================================ test session starts =============================================================================
platform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /, inifile:
collecting 0 items [crackauc@crackauc2 /]$ PYTHONPATH=$(pwd) python3.6 -m pytest
============================================================================ test session starts =============================================================================
platform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /, inifile:
collected 0 items / 1 errors
=================================================================================== ERRORS ===================================================================================
_____________________________________________________________________________ ERROR collecting ______________________________________________________________________________
usr/lib/python3.6/site-packages/py/_error.py:66: in checked_call
return func(*args, **kwargs)
E PermissionError: [Errno 13] Permission denied: '//boot/grub2'
During handling of the above exception, another exception occurred:
usr/lib/python3.6/site-packages/py/_path/common.py:377: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
usr/lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
usr/lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
usr/lib/python3.6/site-packages/py/_path/common.py:414: in gen
entries = path.listdir()
usr/lib/python3.6/site-packages/py/_path/local.py:387: in listdir
names = py.error.checked_call(os.listdir, self.strpath)
usr/lib/python3.6/site-packages/py/_error.py:86: in checked_call
raise cls("%s%r" % (func.__name__, args))
E py.error.EACCES: [Permission denied]: listdir('//boot/grub2',)
============================================================================== warnings summary ==============================================================================
None
could not create cache path /.pytest_cache/v/cache/nodeids
could not create cache path /.pytest_cache/v/cache/lastfailed
-- Docs: http://doc.pytest.org/en/latest/warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==================================================================== 2 warnings, 1 error in 0.49 seconds =====================================================================
[crackauc@crackauc2 /]$ sudo PYTHONPATH=$(pwd) python3.6 -m pytest
[sudo] password for crackauc:
============================================================================ test session starts =============================================================================
platform linux -- Python 3.6.4, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /, inifile:
collected 0 items / 1 errors
=================================================================================== ERRORS ===================================================================================
_____________________________________________________________________________ ERROR collecting ______________________________________________________________________________
usr/lib/python3.6/site-packages/_pytest/config.py:334: in _getconftestmodules
return self._path2confmods[path]
E KeyError: local('//lib64/python2.7/site-packages/numpy')
During handling of the above exception, another exception occurred:
usr/lib/python3.6/site-packages/_pytest/config.py:365: in _importconftest
return self._conftestpath2mod[conftestpath]
E KeyError: local('//lib64/python2.7/site-packages/numpy/conftest.py')
During handling of the above exception, another exception occurred:
//lib64/python2.7/site-packages/numpy/core/__init__.py:16: in <module>
from . import multiarray
E ImportError: //lib64/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: _Py_ZeroStruct
During handling of the above exception, another exception occurred:
usr/lib/python3.6/site-packages/_pytest/config.py:371: in _importconftest
mod = conftestpath.pyimport()
usr/lib/python3.6/site-packages/py/_path/local.py:668: in pyimport
__import__(modname)
//lib64/python2.7/site-packages/numpy/__init__.py:142: in <module>
from . import add_newdocs
//lib64/python2.7/site-packages/numpy/add_newdocs.py:13: in <module>
from numpy.lib import add_newdoc
//lib64/python2.7/site-packages/numpy/lib/__init__.py:8: in <module>
from .type_check import *
//lib64/python2.7/site-packages/numpy/lib/type_check.py:11: in <module>
import numpy.core.numeric as _nx
//lib64/python2.7/site-packages/numpy/core/__init__.py:26: in <module>
raise ImportError(msg)
E ImportError:
E Importing the multiarray numpy extension module failed. Most
E likely you are trying to import a failed build of numpy.
E If you're working with a numpy git repo, try `git clean -xdf` (removes all
E files not under version control). Otherwise reinstall numpy.
E
E Original error was: //lib64/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: _Py_ZeroStruct
During handling of the above exception, another exception occurred:
usr/lib/python3.6/site-packages/py/_path/common.py:377: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
usr/lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
usr/lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
usr/lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
usr/lib/python3.6/site-packages/py/_path/common.py:418: in gen
dirs = self.optsort([p for p in entries
usr/lib/python3.6/site-packages/py/_path/common.py:419: in <listcomp>
if p.check(dir=1) and (rec is None or rec(p))])
usr/lib/python3.6/site-packages/_pytest/main.py:434: in _recurse
ihook = self.gethookproxy(path)
usr/lib/python3.6/site-packages/_pytest/main.py:338: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
usr/lib/python3.6/site-packages/_pytest/config.py:348: in _getconftestmodules
mod = self._importconftest(conftestpath)
usr/lib/python3.6/site-packages/_pytest/config.py:376: in _importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E _pytest.config.ConftestImportFailure: ImportError("\nImporting the multiarray numpy extension module failed. Most\nlikely you are trying to import a failed build of numpy.\nIf you're working with a numpy git repo, try `git clean -xdf` (removes all\nfiles not under version control). Otherwise reinstall numpy.\n\nOriginal error was: //lib64/python2.7/site-packages/numpy/core/multiarray.so: undefined symbol: _Py_ZeroStruct\n",)
E File "//lib64/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
E from . import add_newdocs
E File "//lib64/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
E from numpy.lib import add_newdoc
E File "//lib64/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
E from .type_check import *
E File "//lib64/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
E import numpy.core.numeric as _nx
E File "//lib64/python2.7/site-packages/numpy/core/__init__.py", line 26, in <module>
E raise ImportError(msg)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================== 1 error in 67.62 seconds ==========================================================================
@ChrisRackauckas Why not use tox? You can avoid this kind of it-works-in-my-computer problem. It simplifies Travis setup as well.
I know tox does not work with conda and probably many DifferentialEquations.jl dependencies invoke conda... But for testing interface to simple pure-Julia code, it may be fine.
OK. I had a look at the code. First of all, the way Python organize unit tests are different from Julia: the tests have to be wrapped it into a function or a class. There are only two such cases in diffeqpy/tests which are in test_ode.py.
Second, I think pytest's default behavior is to stop test collection once it encounter an import error. This may explain why pytest in @bjodah environment can find tests while @ChrisRackauckas's can't. Since test_ode.py has import numba, pytest won't find tests unless it has numba installed in the environment. My guess is that @bjodah had numba installed while @ChrisRackauckas didn't.
I think I've encounter LLVM incompatibility issue in Julia and Numba. Even python -c 'import diffeqpy.tests.test_ode' segfaults. Reading JuliaPy/PyCall.jl#220 (comment) it looks like I need to install the right version of llvmlite. But building old version of llvmlite (0.16.0) requires an old version of LLVM (3.9.x) which I don't have at the moment.
I think I've encounter LLVM incompatibility issue in Julia and Numba. Even python -c 'import diffeqpy.tests.test_ode' segfaults. Reading JuliaPy/PyCall.jl#220 (comment) it looks like I need to install the right version of llvmlite. But building old version of llvmlite (0.16.0) requires an old version of LLVM (3.9.x) which I don't have at the moment.
That issue doesn't apply since we never PyCall numba. Instead, the user can optionally give an already JIT compiled Numba function, but Julia/PyCall shouldn't ever know that Numba was involved.
It seems that the segfault is problem in my environment.
But you are not providing a reproducible way to make it work elsewhere. tox helps for that, at least for running tests.
What do you mean by that?
I mean, you are not providing a single entry point for running unit tests. For example, numba also has to be installed for the test. Manual installtion is not developer-friendly and doesn't scale if you need more packages. Also, ideally, it'd be better if it's isolated from user's environment. Julia needs to wait for Pkg3 for that, but Python already has it (virtualenv/venv) and a wrapper for testing (tox).
Is there a way to use tox but not require it to precompile DiffEqPy each time? I guess that's just a test time problem but there must be a way to run it without rebuilding PyCall and recompiling the whole thing.
I mean, you are not providing a single entry point for running unit tests. For example, numba also has to be installed for the test. Manual installtion is not developer-friendly and doesn't scale if you need more packages. Also, ideally, it'd be better if it's isolated from user's environment. Julia needs to wait for Pkg3 for that, but Python already has it (virtualenv/venv) and a wrapper for testing (tox).
Yeah, part of the reason for doing this is to have an application for compiler/ecosystem folks to test and develop with. I hope that when the release of diffeqr and diffeqpy happen, that will then be a good incentive for Julia devs to care about the JuliaCall and pyjulia tools (we definitely will) along with the intersections of Pkg3 with static compilation and external calls, and so it'll start a nice feedback loop.
Is there a way to use tox but not require it to precompile DiffEqPy each time? I guess that's just a test time problem but there must be a way to run it without rebuilding PyCall and recompiling the whole thing.
Looks like that's just stalling when in the -py36 test. Happened to me locally, and happened on Travis:
Is there a way to use tox but not require it to precompile DiffEqPy each time? I guess that's just a test time problem but there must be a way to run it without rebuilding PyCall and recompiling the whole thing.
I don't know why PyCall needs rebuild each time so I don't know how to fix it.
If you just need to quickly run tests without invoking stuff inside tox.ini, you can just do
One thing I've forgotten was that Julia loads .juliarc.jl even for non-interactive session. Since I had ENV["PYTHON"] = ..., the setting in tox.ini was overwritten. If I empty .juliarc.jl then I can import diffeqpy.tests.test_ode but still the tests do not run.
It looks like the test itself choke sometimes randomly. It happens both locally and in Travis. It's probably that using DiffEqPy hangs. When it occurs, sudo strace -p <pid> shows something like
futex(0x7f507c45caa0, FUTEX_WAIT_PRIVATE, 2, NULL
I'm not sure it helps. Does it mean there is a deadlock somewhere in Julia-Python bridge?
Anyway, since it happens also locally, I guess Travis setup itself is fine.
I don't know what is happening in AppVeyor. tox should be using whatever installed in that system. So, as long as Python and Julia are compatible to the system, I think the rest should be handled by pip via tox without problem. But I'm not familiar with Windows...
Activity
ChrisRackauckas commentedon Apr 22, 2018
pytest doesn't seem to be finding the tests?
bjodah commentedon Apr 22, 2018
I think the last 3 lines in
setup.py:usually go into
setup.cfg(and I think the "new" header is[tool:pytest]).But I think those globs are the default. My typical setup.cfg looks like this:
In
setup.py, I would also change:into
and add an empty file
diffeqpy/tests/__init__.py.That would include tests in the source distribution and one would then be able to execute e.g.
python3.5 -m pytest --pyargs diffeqpyfrom anywhere on a machine withdiffeqpyinstalled.It should also work if it is a "development" installation (I would recommend installing via
python3.5 -m pip install --user -e .orpython3.5 setup.py develop --user). Alternatively one can setPYTHONPATH=/path/to/diffeqpyand runpytestfrom the package root.ChrisRackauckas commentedon Apr 22, 2018
I think I made the changes @bjodah described but tests are still coming up blank. I pushed everything to master so you can see what the current setup it (I believe it matches what you were saying there).
bjodah commentedon Apr 22, 2018
Hmmm.. maybe try:
or:
ChrisRackauckas commentedon Apr 22, 2018
Looks like versions are mixed for some reason:
bjodah commentedon Apr 22, 2018
Weird, for me I can run pytest from outside the root without errors:
ChrisRackauckas commentedon Apr 22, 2018
Is there some package installation step that has to be done?
bjodah commentedon Apr 22, 2018
I have run:
in the repo root before-hand. Which created a link:
tkf commentedon Apr 23, 2018
@ChrisRackauckas Why not use tox? You can avoid this kind of it-works-in-my-computer problem. It simplifies Travis setup as well.
I know tox does not work with conda and probably many DifferentialEquations.jl dependencies invoke conda... But for testing interface to simple pure-Julia code, it may be fine.
tkf commentedon Apr 23, 2018
OK. I had a look at the code. First of all, the way Python organize unit tests are different from Julia: the tests have to be wrapped it into a function or a class. There are only two such cases in diffeqpy/tests which are in test_ode.py.
Second, I think pytest's default behavior is to stop test collection once it encounter an import error. This may explain why pytest in @bjodah environment can find tests while @ChrisRackauckas's can't. Since test_ode.py has
import numba, pytest won't find tests unless it has numba installed in the environment. My guess is that @bjodah had numba installed while @ChrisRackauckas didn't.ChrisRackauckas commentedon Apr 23, 2018
I have no idea what that is.
I didn't finish changing them because pytest won't run.
The code works for me (I wrote the README).
tkf commentedon Apr 23, 2018
I think I've encounter LLVM incompatibility issue in Julia and Numba. Even
python -c 'import diffeqpy.tests.test_ode'segfaults. Reading JuliaPy/PyCall.jl#220 (comment) it looks like I need to install the right version of llvmlite. But building old version of llvmlite (0.16.0) requires an old version of LLVM (3.9.x) which I don't have at the moment.tkf commentedon Apr 23, 2018
But you are not providing a reproducible way to make it work elsewhere. tox helps for that, at least for running tests.
ChrisRackauckas commentedon Apr 23, 2018
What do you mean by that? Just that we need the checkout? I want to just get that fixed instead:
JuliaPy/PyCall.jl#496
ChrisRackauckas commentedon Apr 23, 2018
That issue doesn't apply since we never PyCall numba. Instead, the user can optionally give an already JIT compiled Numba function, but Julia/PyCall shouldn't ever know that Numba was involved.
1 remaining item
tkf commentedon Apr 23, 2018
Indeed, it works:
https://travis-ci.org/JuliaDiffEq/diffeqpy/builds/369923283
It seems that the segfault is problem in my environment.
I mean, you are not providing a single entry point for running unit tests. For example, numba also has to be installed for the test. Manual installtion is not developer-friendly and doesn't scale if you need more packages. Also, ideally, it'd be better if it's isolated from user's environment. Julia needs to wait for Pkg3 for that, but Python already has it (virtualenv/venv) and a wrapper for testing (tox).
ChrisRackauckas commentedon Apr 23, 2018
Is there a way to use
toxbut not require it to precompile DiffEqPy each time? I guess that's just a test time problem but there must be a way to run it without rebuilding PyCall and recompiling the whole thing.Do you know what's trying to use apt on Mac @tkf? https://travis-ci.org/JuliaDiffEq/diffeqpy/jobs/369935686#L28 I don't have any apt commands in the repo. If tox isn't compatible with Mac that's fine, but then we should at least change those tests to allow failure for now.
Yeah, part of the reason for doing this is to have an application for compiler/ecosystem folks to test and develop with. I hope that when the release of diffeqr and diffeqpy happen, that will then be a good incentive for Julia devs to care about the JuliaCall and pyjulia tools (we definitely will) along with the intersections of Pkg3 with static compilation and external calls, and so it'll start a nice feedback loop.
ChrisRackauckas commentedon Apr 23, 2018
Looks like that's just stalling when in the
-py36test. Happened to me locally, and happened on Travis:https://travis-ci.org/JuliaDiffEq/diffeqpy/jobs/369935685
I am more than slightly puzzled by that.
ChrisRackauckas commentedon Apr 23, 2018
Locally having
-py27issues too.tkf commentedon Apr 23, 2018
I don't know why PyCall needs rebuild each time so I don't know how to fix it.
If you just need to quickly run tests without invoking stuff inside tox.ini, you can just do
Note that this runs tests installed in .tox/py36/lib. If you want this workflow, it's better to set
usedevelop = true(http://tox.readthedocs.io/en/latest/config.html#confval-usedevelop=BOOL) so that the code in the git repository is used.Hmm... That's puzzling. But it looks like it had happened before my PR https://travis-ci.org/JuliaDiffEq/diffeqpy/jobs/369880767#L28
tkf commentedon Apr 23, 2018
The issue in Travis is during
using DiffEqPyhttps://travis-ci.org/JuliaDiffEq/diffeqpy/jobs/369935685#L980 and your local py27 failure is from py.test so I don't know if they are related.tkf commentedon Apr 23, 2018
BTW, encouraging people to care about interoperability by releasing diffeqr and diffeqpy is really a great move!! Thank you!
tkf commentedon Apr 23, 2018
Oops. I clicked the redo button in Travis to see if the problem is reproducible. But it turned out that Travis throws away old build. So the link https://travis-ci.org/JuliaDiffEq/diffeqpy/jobs/369935685#L980 above won't make sense anymore...
tkf commentedon Apr 23, 2018
Nevermind, it produces the same error.
tkf commentedon Apr 23, 2018
One thing I've forgotten was that Julia loads .juliarc.jl even for non-interactive session. Since I had
ENV["PYTHON"] = ..., the setting in tox.ini was overwritten. If I empty .juliarc.jl then I can import diffeqpy.tests.test_ode but still the tests do not run.ChrisRackauckas commentedon Apr 23, 2018
It seems I need to run
each time I switch Python versions. I wonder if that's some kind of race condition related to precompilation that needs to be reported to pyjulia.
ChrisRackauckas commentedon Apr 25, 2018
It looks like Travis is good now. AppVeyor is having a 32-bit vs 64-bit issue due to tox I think. @tkf can you check it out?
tkf commentedon Apr 25, 2018
It looks like the test itself choke sometimes randomly. It happens both locally and in Travis. It's probably that
using DiffEqPyhangs. When it occurs,sudo strace -p <pid>shows something likeI'm not sure it helps. Does it mean there is a deadlock somewhere in Julia-Python bridge?
Anyway, since it happens also locally, I guess Travis setup itself is fine.
I don't know what is happening in AppVeyor. tox should be using whatever installed in that system. So, as long as Python and Julia are compatible to the system, I think the rest should be handled by pip via tox without problem. But I'm not familiar with Windows...
tkf commentedon Apr 25, 2018
Oh, appveyor has many Python interpreters installed in one environment. I see... https://www.appveyor.com/docs/build-environment/#python