2019-01-17 02:51:33 +00:00
|
|
|
import os
|
|
|
|
from unittest import TestCase
|
- Replaced pipenv with poetry
- Updated min version check in setup.py to Python 3.6
- Updated isort config file and calls to align with v5.x
- Added init-hook for gi imports in .pylintrc to avoid invalid no-member issues
- Makefile: added lock, show-tree, bandit, black, mypy; updated test, cover, dev, isort, autopep8, check, isort-check, flake8, pylint; removed req, requirements;
- Updated .travis.yml to use poetry and make
- Added my email in AUTHORS
- Updated CONTRIBUTING.md
- Updated lint_python.yml to use poetry and make, reorganized instructions to have all install related steps first
- sorted imports: lutris, lutris-wrapper, cleanup_prefix.py and multiple files in tests dir
2021-10-24 18:42:06 +00:00
|
|
|
|
2019-01-17 02:51:33 +00:00
|
|
|
from lutris.util.graphics.glxinfo import GlxInfo
|
|
|
|
|
2024-02-25 05:02:06 +00:00
|
|
|
FIXTURES_PATH = os.path.join(os.path.dirname(__file__), "fixtures")
|
2019-01-17 02:51:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
class BaseGlxInfo(TestCase):
|
|
|
|
fixture = None
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
output = self.read_fixture(self.fixture)
|
|
|
|
self.glxinfo = GlxInfo(output)
|
|
|
|
|
|
|
|
def read_fixture(self, fixture_filename):
|
|
|
|
with open(os.path.join(FIXTURES_PATH, fixture_filename)) as fixture:
|
|
|
|
content = fixture.read()
|
|
|
|
return content
|
|
|
|
|
|
|
|
|
|
|
|
class TestAMDGlxInfo(BaseGlxInfo):
|
2024-02-25 05:02:06 +00:00
|
|
|
fixture = "glxinfo-amd.txt"
|
2019-01-17 02:51:33 +00:00
|
|
|
|
|
|
|
"""GlxInfo tests"""
|
2024-02-25 05:02:06 +00:00
|
|
|
|
2019-01-17 02:51:33 +00:00
|
|
|
def test_can_get_name_of_display(self):
|
|
|
|
self.assertEqual(self.glxinfo.display, ":0")
|
|
|
|
self.assertEqual(self.glxinfo.screen, "0")
|
2024-02-25 05:02:06 +00:00
|
|
|
self.assertEqual(self.glxinfo.opengl_version, "4.5 (Compatibility Profile) Mesa 19.0.0-devel - padoka PPA")
|
2019-01-17 02:51:33 +00:00
|
|
|
self.assertEqual(self.glxinfo.opengl_vendor, "X.Org")
|
|
|
|
self.assertEqual(self.glxinfo.GLX_MESA_query_renderer.version, "19.0.0")
|
|
|
|
|
|
|
|
|
|
|
|
class TestNvidiaGlxInfo(BaseGlxInfo):
|
|
|
|
"""GlxInfo tests"""
|
2024-02-25 05:02:06 +00:00
|
|
|
|
|
|
|
fixture = "glxinfo-nvidia.txt"
|
2019-01-17 02:51:33 +00:00
|
|
|
|
|
|
|
def test_can_get_name_of_display(self):
|
|
|
|
self.assertEqual(self.glxinfo.display, ":0")
|
|
|
|
self.assertEqual(self.glxinfo.screen, "0")
|
|
|
|
self.assertEqual(self.glxinfo.opengl_version, "4.6.0 NVIDIA 415.25")
|
|
|
|
self.assertEqual(self.glxinfo.opengl_vendor, "NVIDIA Corporation")
|
|
|
|
with self.assertRaises(AttributeError):
|
2020-04-26 16:42:38 +00:00
|
|
|
self.glxinfo.GLX_MESA_query_renderer.version # pylint: disable=pointless-statement
|