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

Enable Qtile tests #93837

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

deliciouslytyped
Copy link
Contributor

@deliciouslytyped deliciouslytyped commented Jul 25, 2020

Following up on qtile/qtile#1828, this enables tests for qtile.
I will disable the failing tests with a push in a few minutes, since I believe partial testing is still better than none, and then reenabling them can be worked on later.

refactor:
remove rec and move version into the let expression
rename python37Packages usages to "pypa"

enabled tests:
patch conftest to keep the nix python environment variables, this fixes all the enabled tests
add test dependencies
run pytest with xvfb-run with HOME set for the duration of the test
@deliciouslytyped
Copy link
Contributor Author

I'm not sure but tests might be failing nondeterministically.

@Lassulus
Copy link
Member

builder for '/nix/store/kgl4w97v1wigabysi9cib1qrn58dl6fm-qtile-0.16.0.drv' failed with exit code 1; last 10 log lines:
    /build/source/libqtile/utils.py:141: UnixCommandNotFound: No such file or directory: 'sensors'
      warnings.warn(err.strerror, warning)
  
  -- Docs: https://docs.pytest.org/en/latest/warnings.html
  =========================== short test summary info ============================
  FAILED test/test_images.py::test_get_cairo_surface[/build/source/test/data/svg/audio-volume-muted.svg]
  ERROR test/test_manager.py::test_events[xephyr0-ManagerConfig] - AssertionErr...
  ERROR test/test_manager.py::test_adddelgroup[xephyr0-ManagerConfig] - Asserti...
  ERROR test/test_manager.py::test_xeyes[xephyr1-ManagerConfig] - AssertionErro...
  = 1 failed, 265 passed, 14 skipped, 87 deselected, 1 warning, 3 errors in 133.25s (0:02:13) =

@Lassulus
Copy link
Member

this time I got:

builder for '/nix/store/bznzgdcz5ggz109w2pd0kdcn6dl9fsgv-qtile-0.16.0.drv' failed with exit code 1; last 10 log lines:
  Errors from xkbcomp are not fatal to the X server
  =============================== warnings summary ===============================
  test/widgets/test_misc.py::test_thermalsensor_regex_compatibility
    /build/source/libqtile/utils.py:141: UnixCommandNotFound: No such file or directory: 'sensors'
      warnings.warn(err.strerror, warning)
  
  -- Docs: https://docs.pytest.org/en/latest/warnings.html
  =========================== short test summary info ============================
  ERROR test/test_manager.py::test_match[xephyr0-ManagerConfig] - AssertionErro...
  = 238 passed, 1 skipped, 130 deselected, 1 warning, 1 error in 110.37s (0:01:50) =
cannot build derivation '/nix/store/k7nhspbbwnv3ypfib3a4c5sjf3zmn0y2-env.drv': 1 dependencies couldn't be built
[0 built (1 failed), 0.0 MiB DL]
error: build of '/nix/store/k7nhspbbwnv3ypfib3a4c5sjf3zmn0y2-env.drv' failed
https://github.com/NixOS/nixpkgs/pull/93837
1 package failed to build:
qtile

@deliciouslytyped
Copy link
Contributor Author

deliciouslytyped commented Jul 26, 2020

Dev says " xcffib.ConnectionException: xcb connection errors because of socket, pipe and other stream errors." means the X server is crashing. I don't know why, but an intermediate workaround seems to be to use pytest-rerunfailures to rerun tests.
I don't know what the failure probability is, so I chose 5 retries arbitrarily.

Some bad statistics:
Assuming randomly distributed failures (which is probably wrong), if 20 out of 300 tests fail, we estimate a failure probability of 1/15. 5 runs of that should be low enough

Edit: It's notable that those are marked "ERROR" and actually failing tests are marked "FAILED".

@deliciouslytyped
Copy link
Contributor Author

Looks like the svg errors are due to env vars being lost somewhere again;

$ GDK_PIXBUF_MODULE_FILE= python
Python 3.7.4 (default, Jul  8 2019, 18:31:06) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairocffi.pixbuf as p
>>> p.decode_to_pixbuf(open("wat.svg", "rb").read())

(process:27392): GdkPixbuf-WARNING **: 22:28:18.267: Cannot open pixbuf loader module file '': No such file or directory

This likely means that your installation is broken.
Try running the command
  gdk-pixbuf-query-loaders > 
to make things work again for the time being.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/lyza33w1nam3y3h6qp8qm3habj3f6jbi-python3-3.7.4-env/lib/python3.7/site-packages/cairocffi/pixbuf.py", line 91, in decode_to_pixbuf
    handle_g_error(error, gdk_pixbuf.gdk_pixbuf_loader_close(loader, error))
  File "/nix/store/lyza33w1nam3y3h6qp8qm3habj3f6jbi-python3-3.7.4-env/lib/python3.7/site-packages/cairocffi/pixbuf.py", line 55, in handle_g_error
    raise ImageLoadingError(message)
cairocffi.pixbuf.ImageLoadingError: Pixbuf error: Unrecognized image file format
>>> 



$ python
Python 3.7.4 (default, Jul  8 2019, 18:31:06) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairocffi.pixbuf as p
>>> p.decode_to_pixbuf(open("wat.svg", "rb").read())
(<cairocffi.pixbuf.Pixbuf object at 0x7f31ca4d7510>, 'svg')
>>> 

src = ./0003-Restart-executable.patch;
out = "$out";
})
./0004-Keep-env-in-test-process-spawner.patch #TODO upstream this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about doing it? :)

Comment on lines +77 to +80
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
--set QTILE_WRAPPER '$0' \
--set QTILE_SAVED_PYTHONPATH '$PYTHONPATH' \
--set QTILE_SAVED_PATH '$PATH'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't built it locally, but I think there's double wrapping here. If I'm correct, could you please use makeWrapperArgs?

buildInputs = [ glib libxcb cairo pango python37Packages.xcffib ];
buildInputs = [ glib libxcb cairo pango pypa.xcffib librsvg ];

pythonPath = with pypa; [ xcffib cairocffi-xcffib setuptools setuptools_scm ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

@@ -17,34 +26,60 @@ python37Packages.buildPythonApplication rec {
};

patches = [
./0001-Substitution-vars-for-absolute-paths.patch
(substituteAll {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to have a comment above each patch explaining them.

@deliciouslytyped
Copy link
Contributor Author

Just leaving a note here that I'm not sure when I will be working on this again, so if anyone is interested, feel free to take it up!
I'll leave a note if I pick it up again.

@stale
Copy link

stale bot commented Jul 21, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 21, 2021
@wegank wegank marked this pull request as draft March 20, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants