Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pytest and rootdirectory
#1
Hello.

I have a lot of tests and run with pytest. Some code (in product, not in tests) perform operations like os.chdir(some_dir), thus tests which are looking for some testdata always fail after that if I run all tests. And these tests always work if run them separately. So, the question is - how to return back to root directory for each test? Probably, it should be a fixture, but how to determine root directory? Setup some variable during the first run?
Reply


Messages In This Thread
Pytest and rootdirectory - by Master_Sergius - May-31-2020, 06:02 PM
RE: Pytest and rootdirectory - by Larz60+ - Jun-01-2020, 12:24 AM
RE: Pytest and rootdirectory - by Master_Sergius - Jun-01-2020, 08:45 AM
RE: Pytest and rootdirectory - by Larz60+ - Jun-01-2020, 10:32 AM
RE: Pytest and rootdirectory - by Master_Sergius - Jun-01-2020, 05:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Pytest Installed, but VS Code Won’t Access Pytest AstralWeeks 9 3,442 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  Pytest mocks anthonyrmoss78 0 466 May-30-2023, 08:28 PM
Last Post: anthonyrmoss78
  Pytest with requests a21250450 3 2,790 Mar-21-2019, 03:24 PM
Last Post: buran
  pytest and caplog lazyliv 0 3,089 May-16-2018, 02:36 PM
Last Post: lazyliv

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020