From a26215f7c0d8ae30e0f9f946c1f8e07305c0a186 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 20 Sep 2024 14:58:42 -0500 Subject: [PATCH] Move empty_repo to conftest.py --- test/conftest.py | 18 ++++++++++++++++++ test/test_yamllint_checks.py | 11 ----------- 2 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 test/conftest.py diff --git a/test/conftest.py b/test/conftest.py new file mode 100644 index 0000000..fa6ec6b --- /dev/null +++ b/test/conftest.py @@ -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 diff --git a/test/test_yamllint_checks.py b/test/test_yamllint_checks.py index 05fa682..931bdf4 100644 --- a/test/test_yamllint_checks.py +++ b/test/test_yamllint_checks.py @@ -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)