Files
mandy/tests/test_docs_issue_template.py
fiestorra 2cfbe969c9 issues: the bug report template says how to get a log
Reports arrive saying they have no log:

    Could not find a log file. I checked the expected log directory from the documentation,
    but no log file was generated.      (#3122's Output)

That is right: the D3D12 runtime writes nothing under %LOCALAPPDATA%\Leonida\logs until `-Log`
is passed, and the template asked only for "the last lines the console printed". So the Output
field now names the switch, the file and the first lines worth reading in it:

    For the D3D12 runtime add -Log to play-nvidia.ps1 or play-d3d12.ps1 - the file is
    %LOCALAPPDATA%\Leonida\logs\play-*.log, and without -Log nothing is written there; its
    last 30 lines name the card (host wave lanes), the shader cache (shader preparation) and
    the error.

`python -I tests/test_docs_issue_template.py`: 2 tests, OK. The second is the control - an
empty template lists all three hints, so the first test cannot pass on a template that lost
them. `python -m unittest discover -s tests -p "test_docs_*.py"`: 57 tests, OK.

Written with an AI assistant.
2026-12-02 15:57:03 +01:00

35 lines
1.4 KiB
Python

"""The bug report template says how to get a D3D12 log.
python -I tests/test_docs_issue_template.py
Reports arrive with "Could not find a log file. I checked the expected log directory from the
documentation, but no log file was generated" (#3122's own output), because the runtime writes
nothing there until `-Log` is passed. The template asks for "the last lines the console
printed"; without the switch there are none to paste, so it now names the switch, the file and
the first lines worth reading. This reads the template only. No game files.
"""
import os
import unittest
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
TEMPLATE = os.path.join(".github", "ISSUE_TEMPLATE", "bug_report.yml")
HINTS = ("-Log", "%LOCALAPPDATA%\\Leonida\\logs", "play-nvidia.ps1")
def missing_hints(template):
"""The hints a report needs that `template` does not carry."""
return [hint for hint in HINTS if hint not in template]
class BugReportTemplateTest(unittest.TestCase):
def test_the_output_field_says_how_to_get_a_log(self):
with open(os.path.join(ROOT, TEMPLATE), encoding="utf-8") as f:
self.assertEqual(missing_hints(f.read()), [])
def test_a_template_without_the_hints_is_caught(self):
self.assertEqual(len(missing_hints("label: Output\ndescription: the last lines\n")), len(HINTS))
if __name__ == "__main__":
unittest.main()