pytest: strict config (#29676)

* pytest: strict config

* collection works

* fixes
old-commit-hash: 72e2e2c9ec4e3a42cf35c23dfc0d66ea0565ace6
This commit is contained in:
Adeeb Shihadeh
2023-08-28 10:26:19 -07:00
committed by GitHub
parent 3627574114
commit cc29c6640d
4 changed files with 19 additions and 18 deletions

BIN
poetry.lock LFS generated

Binary file not shown.

View File

@@ -1,8 +1,8 @@
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ --ignore=laika_repo/"
addopts = "--ignore=opendbc/ --ignore=panda/ --ignore=rednose_repo/ --ignore=tinygrad_repo/ --ignore=laika_repo/ -Werror --strict-config --strict-markers"
python_files = "test_*.py"
timeout = "30" # you get this long by default
#timeout = "30" # you get this long by default
[tool.mypy]
python_version = "3.11"
@@ -124,6 +124,8 @@ pytest = "*"
pytest-cov = "*"
pytest-subtests = "*"
pytest-xdist = "*"
pytest-timeout = "*"
pytest-timeouts = "*"
scipy = "*"
sphinx = "*"
sphinx-rtd-theme = "*"

View File

@@ -14,7 +14,7 @@ from openpilot.system.loggerd.uploader import uploader_fn, UPLOAD_ATTR_NAME, UPL
from openpilot.system.loggerd.tests.loggerd_tests_common import UploaderTestCase
class TestLogHandler(logging.Handler):
class FakeLogHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
self.reset()
@@ -33,7 +33,7 @@ class TestLogHandler(logging.Handler):
except Exception:
pass
log_handler = TestLogHandler()
log_handler = FakeLogHandler()
cloudlog.addHandler(log_handler)

View File

@@ -18,19 +18,18 @@ class TestPlotJuggler(unittest.TestCase):
install()
pj = os.path.join(PJ_DIR, "juggle.py")
p = subprocess.Popen(f'QT_QPA_PLATFORM=offscreen {pj} --demo None 1 --qlog',
stderr=subprocess.PIPE, shell=True, start_new_session=True)
with subprocess.Popen(f'QT_QPA_PLATFORM=offscreen {pj} --demo None 1 --qlog',
stderr=subprocess.PIPE, shell=True, start_new_session=True) as p:
# Wait for "Done reading Rlog data" signal from the plugin
output = "\n"
with Timeout(180, error_msg=output):
while output.splitlines()[-1] != "Done reading Rlog data":
output += p.stderr.readline().decode("utf-8")
# Wait for "Done reading Rlog data" signal from the plugin
output = "\n"
with Timeout(180, error_msg=output):
while output.splitlines()[-1] != "Done reading Rlog data":
output += p.stderr.readline().decode("utf-8")
# ensure plotjuggler didn't crash after exiting the plugin
time.sleep(15)
self.assertEqual(p.poll(), None)
os.killpg(os.getpgid(p.pid), signal.SIGTERM)
# ensure plotjuggler didn't crash after exiting the plugin
time.sleep(15)
self.assertEqual(p.poll(), None)
os.killpg(os.getpgid(p.pid), signal.SIGTERM)
# TODO: also test that layouts successfully load
def test_layouts(self):