Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: prefer pytest.fixture over pytest.fixture() #624

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/test_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def config(tmp_path_factory) -> Config:
return config


@pytest.fixture()
@pytest.fixture
def user_github_token(config: Config, request) -> None:
if request.config.getoption('github_token'):
shutil.copy(request.config.getoption('--github-token'), config.webhook / '.config--github-token')
Expand Down Expand Up @@ -281,14 +281,14 @@ def get_s3(config: Config, pod: PodData, path: str) -> str:
# Per test fixtures
#

@pytest.fixture()
@pytest.fixture
def bots_sha(pod: PodData) -> str:
"""Return the SHA of the bots checkout"""

return exec_c_out(pod.tasks, 'git -C bots rev-parse HEAD').strip()


@pytest.fixture()
@pytest.fixture
def mock_github(pod: PodData, bots_sha: str) -> Iterator[str]:
"""Start mock GitHub API server

Expand Down Expand Up @@ -353,14 +353,14 @@ def generate_config(config: Config, forge_opts: str, run_args: str) -> Path:
return job_conf


@pytest.fixture()
@pytest.fixture
def mock_runner_config(config: Config, pod: PodData) -> Path:
return generate_config(config,
forge_opts=f'api-url = "{GHAPI_URL_POD}"',
run_args=f'"--pod={pod.pod}", "--env=GITHUB_API={GHAPI_URL_POD}"')


@pytest.fixture()
@pytest.fixture
def real_runner_config(config: Config) -> Path:
return generate_config(config, forge_opts='', run_args='')

Expand Down Expand Up @@ -678,7 +678,7 @@ def test_real_pr(config: Config, request, pod: PodData, bots_sha: str, real_runn
# Interactive scenarios
#

@pytest.mark.shell()
@pytest.mark.shell
def test_shell(pod: PodData, user_github_token) -> None:
"""interactive shell for development; run with `pytest -sm shell`"""

Expand Down
Loading