Skip to content

Commit

Permalink
Move empty_repo to conftest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay committed Sep 20, 2024
1 parent 64f2c33 commit a26215f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
18 changes: 18 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Open Source Robotics Foundation, Inc.
# Licensed under the Apache License, Version 2.0

from typing import Iterable

from git import Repo
import pytest


@pytest.fixture
def empty_repo(tmp_path) -> Iterable[Repo]:
with Repo.init(tmp_path) as repo:
repo.index.commit('Initial commit')

base = repo.create_head('main')
base.checkout()

yield repo
11 changes: 0 additions & 11 deletions test/test_yamllint_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@
CONTROL_SUFFIX = 'yankee:\n - zulu\n'


@pytest.fixture
def empty_repo(tmp_path) -> Iterable[Repo]:
with Repo.init(tmp_path) as repo:
repo.index.commit('Initial commit')

base = repo.create_head('main')
base.checkout()

yield repo


@pytest.fixture
def repo_with_yaml(empty_repo) -> Iterable[Repo]:
repo_dir = Path(empty_repo.working_tree_dir)
Expand Down

0 comments on commit a26215f

Please sign in to comment.