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

Test against all supported Python versions and target platforms #108

Closed
bittner opened this issue Sep 23, 2018 · 8 comments · Fixed by #143
Closed

Test against all supported Python versions and target platforms #108

bittner opened this issue Sep 23, 2018 · 8 comments · Fixed by #143
Labels
automation Technical processes that should be automated away, including packaging and releases

Comments

@bittner
Copy link
Member

bittner commented Sep 23, 2018

We should automate testing (and building installers) against all combinations of:

  1. target platforms (Windows, macOS, GNU/Linux distros)
  2. supported Python versions (2.7, 3.5, 3.6, 3.7, PyPy, PyPy3)
  3. supported versions of wxPython (wxgtk2.8, wxgtk3.0, wxgtk4.0)

This may or may not require switching from Travis to (or using in addition) AppVeyor.

It will make sense to use prepared Docker images for all combinations.

Related Issues

@cool-RR
Copy link
Member

cool-RR commented Sep 24, 2018 via email

@bittner
Copy link
Member Author

bittner commented Sep 24, 2018

If PyInstaller is actually packaging Python (3.7) in a way that is completely independent of the target platform and the wxPython version used in PythonTurtle's implementation is actually available for the target platform (or - even better - if also the wxPython dependencies are bundled with the binary) then there should be no need to worry about testing against several combinations.

What I'm worrying about is: If it proves true that substantial changes done to the code base that make PythonTurtle run on Python 3.7 alone entail that it won't run on, say, Windows or macOS you will most probably refuse to merge the changes. For obvious reasons.

Given that there are no tests that allow us to verify (future) changes will work out we need to do some preparation work. Employ linting was one of them (unfortunately with less impact than hoped for -- it would require some pair-programming, a dedicated sprint -- or just so personal dedication of yours as you are the one to know the code base best in order to make critical decisions).

I think, now it's your turn. You've already given your 👍 to using PyInstaller. Now we need a list of what steps are required to make packaging a release happen. For simplicity's sake we take it for granted that the result for running PyInstaller will work on all three supported target platforms (Windows, macOS, GNU/Linux) is some way. If there is anything specific needed for GNU/Linux that you can't determine I'm ready to jump in. Thank you!

@cool-RR
Copy link
Member

cool-RR commented Sep 24, 2018

  1. I think that PyInstaller indeed bundles Python and all its packages in the package. That's what py2exe does. The PyInstaller docs say "PyInstaller bundles a Python application and all its dependencies into a single package".

  2. I don't understand your second paragraph. If you want to move forward with PythonTurtle, you should just make the code run under Python 3.7 and the latest wxPython. Normally, differences between operating system are small in wxPython, and it's not too difficult to fix them. And even if there are differences or minor bugs, fuck it. As long as it kinda works, that would be great.

  3. Regarding tests: Testing GUIs is very difficult. I think that it's good to test GUIs, but even GUIs of programs much more complex with a bigger budget than ours are sometimes lacking in testing. If you just want to quickly see that the program doesn't fail terribly, here's an idea: Make a test that just starts PythonTurtle, waits for 5 seconds and asserts that the process is still alive. This will catch many errors with a low cost. If you want to go a bit further, you can use a GUI interaction library to assert that a window was created with the right title. Most of the actual testing must be manual. Unless you're willing to invest a whole lot of time in a cross-platform GUI testing framework.

  4. I don't see any importance in adding linting right now. I don't object to it, and you can go ahead and do that, but I don't see why it's important or urgent, or what the problems with it are.

  5. Regarding what steps are required: Set up a virtualenv with Python 3.7 and the latest wxPython. Attempt to run PythonTurtle. There will be bugs, fix them one-by-one. Once it works, go through the PyInstaller tutorial to create a PythonTurtle package for one of the OSes. Test that it works. Then try it for the two other OSes. Once that works, ensure that it can be done with just one command, automatically. Set up a CI job to create these installers from source. You can add the minimum-effort testing I mentioned before, if you'd like. When that works, and the program doesn't have bugs that are too severe, we could make a release. Then you could develop more features and fix more bugs and make more releases with those changes. Yes, it's a lot of work.

@bittner
Copy link
Member Author

bittner commented Oct 4, 2018

This issue now seems to be fixed for most parts:

  1. PyInstaller has proven to bundle all dependencies (verified on Ubuntu by @bittner, and on Windows by @cool-RR). ✔️
  2. PyInstaller completely isolates the dependencies, including the Python version and wxPython. This makes it irrelevant to continue supporting older Pythons and matrix-test with different wxPython versions. In future we may also build AppImages to provide yet another distribution format implementing full isolation (on GNU/Linux). ✔️
  3. We now have a test suite. The "tests" are somewhat pointless (in a way that they test what I see that Pylint already does: import the wx module to detect whether the installed prerequisite is actually promoting through to the Python version being tested against). While Pylint spits out warnings, the test abort, though. ✔️
  4. Linting is in place, and being run automatically by Travis. Pylint is now still allowed to fail. I plan to have the remaining complaints fixed, though, and then flip the switch to start enforcing code quality (by stopping to allow build jobs to fail). ✔️
  5. What has to be done for packaging, this is now implemented with a bundle command of setup.py, in a cross-platform way. ✔️

We should probably also run the test suite on both Windows and macOS. Just to make sure that differences across platforms, if they affect our code base, are potentially spotted (or at least, that we can write a test reproducing a platform dependent behavior, if this is being discovered).

@bittner
Copy link
Member Author

bittner commented Oct 5, 2018

Ooops, there is something wrong with the macOS build on Travis:

  • It installs the wxPython for Ubuntu Xenial! (see build details)
  • Instead, it should simply install the package directly from PyPI (via python3 -m pip install wxPython)
  • Not sure why the tests don't fail (neither for installing the package, nor for importing it in Python)

@bittner bittner reopened this Oct 5, 2018
@bittner
Copy link
Member Author

bittner commented Oct 5, 2018

Aha, it actually installs the correct version (a wheel for macOS).

However, the --find-links option should be removed for the macOS case. To avoid confusion, and potential pitfalls.

@bittner bittner added the automation Technical processes that should be automated away, including packaging and releases label Mar 31, 2019
@bittner
Copy link
Member Author

bittner commented Aug 30, 2020

I will likely replace the Travis and AppVeyor builds by GitHub Actions, which covers the whole spectrum and actually works, as proven by the setup I have for PyClean.

For building the MSI installer I found two interesting projects that may be able to help us out:

EDIT There is even a Python-powered WiX-based MSI creator: WiX.Py (unfortuantely still based on Python 2)

I opened sk1project/wixpy#18. Python 3 support seems on its way.

@cool-RR
Copy link
Member

cool-RR commented Aug 30, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation Technical processes that should be automated away, including packaging and releases
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants