useblocks / sphinx-test-reports

Documents test-results inside Sphinx
https://sphinx-test-reports.readthedocs.io/en/latest/
MIT License
28 stars 21 forks source link

Update path handling to support Windows paths #57

Open ntouran opened 1 year ago

ntouran commented 1 year ago

I am trying out this library on Windows and have gotten into a little trouble with paths. In doing a test-report:: directive and passing a unix-style relative path for :file:

.. test-report:: Unit Test Results
   :id: REPORT
   :file: ../project/unit-test-results/project-unit-test-results.xml

I'm seeing the following rendered out:

Test file: C:Usersusernamecodesprojectdoc../project/unit-test-results/unit-test-results.xml

Template used: C:Usersusernamecodesvenvsatom39libsite-packagessphinxcontribtest_reportsdirectives/test_report_template.txt

Statistics
Test suites: 0
...

A similar problem happens when I give a windows-style relative path for :file:, including:

If this used pathlib rather than os.path I believe it might work better? Are you interested in a PR along theses lines?

danwos commented 1 year ago

Thanks for reporting 👍 And sure, every PR is welcome, especially as I have no access to a windows machine to test it.

ntouran commented 1 year ago

Ok, PR #58 should work for both.