from pytest import fixture
from cumulusci.core.github import get_github_api


@fixture
def gh_api():
    return get_github_api("TestOwner", "TestRepo")

import os

from pytest import fixture
from cumulusci.core.github import get_github_api


@fixture
def gh_api():
    return get_github_api("TestOwner", "TestRepo")


@fixture(scope="class", autouse=True)
def restore_cwd():
    d = os.getcwd()
    try:
        yield
    finally:
        os.chdir(d)

Add pytest fixture to avoid leakage of cwd changes
Add pytest fixture to avoid leakage of cwd changes

+ import os
+ 
  from pytest import fixture
  from cumulusci.core.github import get_github_api
  
  
  @fixture
  def gh_api():
      return get_github_api("TestOwner", "TestRepo")
  
+ 
+ @fixture(scope="class", autouse=True)
+ def restore_cwd():
+     d = os.getcwd()
+     try:
+         yield
+     finally:
+         os.chdir(d)
+ 
Add pytest fixture to avoid leakage of cwd changes
## Code Before:
from pytest import fixture
from cumulusci.core.github import get_github_api


@fixture
def gh_api():
    return get_github_api("TestOwner", "TestRepo")

## Instruction:
Add pytest fixture to avoid leakage of cwd changes
## Code After:
import os

from pytest import fixture
from cumulusci.core.github import get_github_api


@fixture
def gh_api():
    return get_github_api("TestOwner", "TestRepo")


@fixture(scope="class", autouse=True)
def restore_cwd():
    d = os.getcwd()
    try:
        yield
    finally:
        os.chdir(d)
