נזכרתי בזה במהלך המלחמה שלי בבניית בדיקות יחידה לאפליקציה לאנדרואיד בסביבת הבדיקה של API 24 והלאה.
I was reminded of this during my war of building unit tests for an Android application in the testing environment of API 24 and later.
Accessibility, Crazy (Event Gripping) Ideas
The other day I found that:
The solution was to build a Docker image based upon Ubuntu 18.04, which does have Python 3.6. See the project https://gitlab.com/TDDPirate/heroku_on_debian in GitLab.
After I complained about flakiness of Selenium-based tests when the Selenium server is running outside of the Docker container while the application runs inside the container, Udi Oron suggested another way to run Python 3.6 on a Debian Stretch system: use pyenv.
Turns out that pyenv solves the pain point of running Python 3.6 on Debian Stretch without having to use a container. So Selenium-based tests are now stable.
The following is an excellent article about using pyenv:
Pyenv – Python Version Management Made Easier
And the following is a link to the GitHub repository:
https://github.com/pyenv/pyenv
I suspect that pyenv is the reason why people are not in a hurry to backport new Python versions to Debian.
When I asked the above question in a Telegram group, people proposed also other tools, which I am summarizing below.
Amiad Bareli, Amit Aronovitch, Meir Gil and Yehuda Deutsch – thanks.
>>> import matplotlib.testing.compare >>> matplotlib.testing.compare.comparable_formats() ['png', 'eps', 'svg', 'pdf']
I have an application written in Python, which uses the ReportLab package for exporting PDF files.
Of course, the application needs to be tested. Among other tests, the PDF export function needs to be tested to ensure that the visual rendering of PDF files did not unexpectedly change.
Since it is possible to create and save an expected-results PDF file using fabricated test data, the above implies the need to compare two PDF files. It turns out that two PDF files created from the same data at two different dates – are different, due to embedded timestamps.
Hence, the need to compare visual renderings of the PDF files. ImageMagick’s convert knows how to convert PDF files into PNG. However, one needs to set the background and remove the alpha channel.
convert knows also to perform bitwise XOR on two image files, but it must be told how to compute the bitwise XOR. This is documented in StackOverflow: Searching for a way to do Bitwise XOR on images.
The script in https://gitlab.com/TDDPirate/compare_pdfs implements all the above.