Skip to content

Pytest cant run when X server is not running (Pynput import problem) #22

Description

@Edios
          Problem with pytest:

Cant run tests without X server. Need to mock pynput KeyCode obj.

`Run conda install pytest
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

All requested packages already installed.

ImportError while loading conftest '/home/runner/work/t9keyboard/t9keyboard/tests/conftest.py'.
tests/conftest.py:6: in
from pynput.keyboard import KeyCode
/usr/share/miniconda/lib/python3.10/site-packages/pynput/init.py:40: in
from . import keyboard
/usr/share/miniconda/lib/python3.10/site-packages/pynput/keyboard/init.py:31: in
backend = backend(name)
/usr/share/miniconda/lib/python3.10/site-packages/pynput/_util/init.py:76: in backend
raise ImportError('this platform is not supported: {}'.format(
E ImportError: this platform is not supported: ('failed to acquire X connection: Can't connect to display ":0.0": [Errno 111] Connection refused', DisplayConnectionError(':0.0', '[Errno 111] Connection refused'))
E
E Try one of the following resolutions:
E
E * Please make sure that you have an X server running, and that the DISPLAY environment variable is set correctly
Error: Process completed with exit code 4.`

Originally posted by @Edios in #21 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions