@@ -36,11 +36,14 @@ def test_create_svn_remote_repo(
36
36
assert svn_remote_1 != svn_remote_2
37
37
38
38
39
- def test_create_git_remote_repo_and_git_sync (
39
+ def test_git_fixtures (
40
40
pytester : pytest .Pytester ,
41
41
monkeypatch : pytest .MonkeyPatch ,
42
+ tmp_path : pathlib .Path ,
42
43
) -> None :
43
- """Tests pytest plugin integration for create_git_remote_repo() and GitSync()."""
44
+ """Tests for libvcs pytest plugin git configuration."""
45
+ monkeypatch .setenv ("HOME" , str (tmp_path ))
46
+
44
47
# Initialize variables
45
48
pytester .plugins = ["pytest_plugin" ]
46
49
pytester .makefile (
@@ -58,6 +61,10 @@ def test_create_git_remote_repo_and_git_sync(
58
61
import pathlib
59
62
import pytest
60
63
64
+ @pytest.fixture(scope="session")
65
+ def vcs_email() -> str:
66
+ return "custom_email@testemail.com"
67
+
61
68
@pytest.fixture(autouse=True)
62
69
def setup(
63
70
request: pytest.FixtureRequest,
@@ -75,7 +82,11 @@ def setup(
75
82
import pathlib
76
83
77
84
from libvcs.sync.git import GitSync
78
- from libvcs.pytest_plugin import CreateRepoPytestFixtureFn
85
+ from libvcs.pytest_plugin import (
86
+ CreateRepoPytestFixtureFn,
87
+ git_remote_repo_single_commit_post_init
88
+ )
89
+
79
90
80
91
def test_repo_git_remote_repo_and_sync(
81
92
create_git_remote_repo: CreateRepoPytestFixtureFn,
@@ -93,75 +104,7 @@ def test_repo_git_remote_repo_and_sync(
93
104
94
105
assert git_repo_checkout_dir.exists()
95
106
assert pathlib.Path(git_repo_checkout_dir / ".git").exists()
96
- """ ,
97
- ),
98
- }
99
- first_test_key = next (iter (files .keys ()))
100
- first_test_filename = str (tests_path / first_test_key )
101
-
102
- tests_path .mkdir ()
103
- for file_name , text in files .items ():
104
- test_file = tests_path / file_name
105
- test_file .write_text (
106
- text ,
107
- encoding = "utf-8" ,
108
- )
109
-
110
- # Test
111
- result = pytester .runpytest (str (first_test_filename ))
112
- result .assert_outcomes (passed = 1 )
113
-
114
-
115
- def test_git_remote_repo (
116
- pytester : pytest .Pytester ,
117
- monkeypatch : pytest .MonkeyPatch ,
118
- tmp_path : pathlib .Path ,
119
- ) -> None :
120
- """Tests for libvcs pytest plugin git configuration."""
121
- monkeypatch .setenv ("HOME" , str (tmp_path ))
122
-
123
- # Initialize variables
124
- pytester .plugins = ["pytest_plugin" ]
125
- pytester .makefile (
126
- ".ini" ,
127
- pytest = textwrap .dedent (
128
- """
129
- [pytest]
130
- addopts=-vv
131
- """ .strip (),
132
- ),
133
- )
134
- pytester .makeconftest (
135
- textwrap .dedent (
136
- r"""
137
- import pathlib
138
- import pytest
139
-
140
- @pytest.fixture(scope="session")
141
- def vcs_email() -> str:
142
- return "custom_email@testemail.com"
143
-
144
- @pytest.fixture(autouse=True)
145
- def setup(
146
- request: pytest.FixtureRequest,
147
- gitconfig: pathlib.Path,
148
- set_home: pathlib.Path,
149
- ) -> None:
150
- pass
151
- """ ,
152
- ),
153
- )
154
- tests_path = pytester .path / "tests"
155
- files = {
156
- "example.py" : textwrap .dedent (
157
- """
158
- import pathlib
159
107
160
- from libvcs.sync.git import GitSync
161
- from libvcs.pytest_plugin import (
162
- CreateRepoPytestFixtureFn,
163
- git_remote_repo_single_commit_post_init
164
- )
165
108
166
109
def test_git_bare_repo_sync_and_commit(
167
110
create_git_remote_bare_repo: CreateRepoPytestFixtureFn,
@@ -206,7 +149,7 @@ def test_git_bare_repo_sync_and_commit(
206
149
207
150
# Test
208
151
result = pytester .runpytest (str (first_test_filename ))
209
- result .assert_outcomes (passed = 1 )
152
+ result .assert_outcomes (passed = 2 )
210
153
211
154
212
155
def test_gitconfig (
0 commit comments