-
Notifications
You must be signed in to change notification settings - Fork 102
Suggestion: Use tox and pytest #178
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
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 (see, e.g., https://ci.appveyor.com/project/Keno/pyjulia/build/1.0.134/job/0l9qvw8dgp1636s4#L158) 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
https://ci.appveyor.com/project/Keno/pyjulia/build/1.0.134/job/s2kvagang1g9e0hu#L201
| @@ -0,0 +1 @@ | |||
| @C:\Python35-x64\python.exe %* | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.