Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pytest and rootdirectory
#5
Nice, but I decided to solve it in the following way:
import os
import pytest


WORKING_DIR = None


@pytest.fixture
def working_dir(autouse=True, scope='function'):
    global WORKING_DIR
    if not WORKING_DIR:
        WORKING_DIR = os.getcwd()
    os.chdir(WORKING_DIR)
    return WORKING_DIR
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,300 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  Pytest mocks anthonyrmoss78 0 453 May-30-2023, 08:28 PM
Last Post: anthonyrmoss78
  Pytest with requests a21250450 3 2,771 Mar-21-2019, 03:24 PM
Last Post: buran
  pytest and caplog lazyliv 0 3,080 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