Fix: Use absolute path for the report#735
Conversation
|
Thanks for this PR. One problem tho, the test passes without the fix. ❯ git branch
beyondevil/fix-report-path-issue
* master
❯ git diff
diff --git a/testing/test_integration.py b/testing/test_integration.py
index 39b46bf..c109456 100644
--- a/testing/test_integration.py
+++ b/testing/test_integration.py
@@ -377,6 +377,21 @@ class TestHTML:
assert_that(col_name).contains("::setup")
assert_that(get_log(page)).contains("ValueError")
+ def test_chdir(self, pytester):
+ pytester.makepyfile(
+ """
+ import pytest
+ @pytest.fixture
+ def changing_dir(tmp_path, monkeypatch):
+ monkeypatch.chdir(tmp_path)
+ yield tmp_path
+ def test_function(changing_dir):
+ pass
+ """
+ )
+ page = run(pytester)
+ assert_results(page, passed=1)
+
@pytest.mark.parametrize("title", ["", "Special Report"])
def test_report_title(self, pytester, title):
pytester.makepyfile("def test_pass(): pass")
❯ hatch -e test run pytest -k test_chdir
============================================================================================= test session starts =============================================================================================
platform darwin -- Python 3.9.10, pytest-7.2.0.dev634+gfbfd4b500, pluggy-1.0.0
rootdir: /Users/jimbrannlund/dev/pytest/pytest-html
configfile: tox.ini
testpaths: testing
plugins: mock-3.10.0, xdist-3.2.1, rerunfailures-11.1.2, metadata-3.0.0, html-4.0.0rc5.dev1+gbab8e54.d20230411
collected 68 items / 67 deselected / 1 selected
testing/test_integration.py . [100%]
====================================================================================== 1 passed, 67 deselected in 0.87s =======================================================================================
|
BeyondEvil
left a comment
There was a problem hiding this comment.
Please also add an entry to the Changelog. 🙏
Sure, I added it. |
No, it's perfect! 👍 |
|
Hmm... is |
|
That would be a bummer |
It seems the path was not resolved to an absolute path? |
Related to this maybe?
https://stackoverflow.com/a/44569249/3845323 Maybe not, as it failed on 3.10 as well... |
Should we try this solution from stackoverflow: |
|
BTW, the |
|
This is so classic.... "It's an easy fix" 🤣 |
|
The test was not using the |
|
Can you try switching back to resolve instead of Path.cwd() now when the test is updated?
…On 13 Sep 2023 at 13:08 +0200, Adrien Berchet ***@***.***>, wrote:
The test was not using the Path.as_uri() method to create the expected value so it was not consistent in the Windows case. Now it should be good 🤞
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
|
I can but I don't think it will work since the job https://github.com/pytest-dev/pytest-html/actions/runs/6169284428/job/16743379351 failed because the |
What’s weird is that it failed on 3.10 as well. Where it’s supposed to work. |
True... Let's see what the CI says |
|
Ah now it works for Python>=3.10 and fails as expected for older versions. So I guess we can just revert to |
BeyondEvil
left a comment
There was a problem hiding this comment.
Let's release this into the wild and see what happens.
Big thanks for all the work, much appreciated! ❤️
|
Ok, thank you very much for your help! |
Fixes #732