Repository navigation
Suggestion: Use tox and pytest - #178
Conversation
|
So it looks like it is not testing "cache reuse" mode at the moment. Let's see if I can find a nice way to fix this... |
2f30486 to
d767c6d
Compare
15b9ca2 to
d1a386c
Compare
so that it's runnable in Windows as well.
The Julia exception objects don't have a `.message` attribute, we can just print the plain object.
|
OK. I think it's ready for review. (ping @stevengj @rdeits) To support "shared-cache mode", I added a script Some summaries for misc details:
Some details for cross-version test in Windows with Python 2.7Note that cross-version test in Windows with Python 2 fails and the failure is ignored at the moment. But it turned out our previous CI setting didn't actually test cross-version capability. The problematic part was here: Line 79 in 9dfc132 There were two issues: (1) I think the way Python 2 cross-version test fails needs attention from PyCall.jl/pyjulia experts. The error happens when evaluating I remember having the same issue when I helped setting up CI for diffeqpy SciML/diffeqpy#25 It used the released version of pyjulia so it's possible that this problem has been there for some times. |
| if fullname.startswith("julia."): | ||
| pypath = os.path.join(os.path.dirname(__file__), | ||
| "{}.py".format(fullname[len("julia."):])) | ||
| if os.path.isfile(pypath): |
There was a problem hiding this comment.
We need to fallback to standard Python importer in this case to import Python submodules (e.g., julia/magic.py).
There was a problem hiding this comment.
Of course, this has to be improved if/when we have python subpackages.
| # Flush, otherwise the Julia startup will keep stdout buffered | ||
| sys.stdout.flush() | ||
| self.julia = Julia(init_julia=True) | ||
| self._julia = Julia(init_julia=True) |
There was a problem hiding this comment.
Previous self.julia = ... was shadowing the method julia. It was fine because the method was actually not called directly in IPython magic system. But it's handy to not shadow for testing.
|
|
||
| def is_same_path(a, b): | ||
| a = os.path.normpath(os.path.normcase(a)) | ||
| b = os.path.normpath(os.path.normcase(b)) |
There was a problem hiding this comment.
os.path.normcase is required in Windows since Python interpreter path reported by Julia and Python have different cases:
pyprogramname = C:\projects\pyjulia\.tox\py\Scripts\python.EXE
sys.executable = C:\projects\pyjulia\.tox\py\Scripts\python.exe
| @@ -0,0 +1 @@ | |||
| @C:\Python35-x64\python.exe %* | |||
There was a problem hiding this comment.
I made ci/appveyor/win*/python*.bat files, following the recommendation here:
https://tox.readthedocs.io/en/latest/developers.html#id2
tox-dev/tox#114 (comment)
Note that adding CI support for Python 3.6 and 3.7 requires adding more of those files.
|
@stevengj Can I merge my PR without a review? Some OSS projects have the policy that you don't merge your own PR. Not sure how it works in JuliaPy. I wonder something like "if my PR does not induce major or minor version bumps, it's likely to be OK to pull it myself" would work. I wouldn't still pull it myself if it's a huge change in the entire codebase like a drastic refactoring. |
|
LGTM. |
It simplifies local development and CI setup:
toxandpytestoutputs are much nicer and helpful (but there are options for verbose outputs)It's WIP since I'm not sure Travis and AppVeyor setups are correct yet.