Continuous integration for program that plot or need a display can be tricky, since in many cases the CI doesn’t have an X11 display server.
Workarounds include generating plots using
xvfb dummy X11 display server.
This maintains code coverage, and may allow dumping plots to disk for further checks
This method uses X server virtual framebuffer (Xvfb) on continuous integration services.
Add to the “.github/workflows/ci.yml”, and assuming the project uses PyTest, the xvfb-action enables Xvfb for that command:
- name: Run headless test uses: GabrielBB/xvfb-action@v1 with: run: pytest
Travis-CI supports Xvfb by adding to project “.travis.yml”: