3 files changed +18
-17
lines changed Original file line number Diff line number Diff line change 6
6
import pytest
7
7
from git import Repo
8
8
from mozlog import get_proxy_logger
9
+ from utils import hg_export_tip
9
10
10
11
from git_hg_sync .__main__ import get_connection , get_queue , start_app
11
12
from git_hg_sync .config import Config
@@ -77,12 +78,5 @@ def test_full_app(
77
78
# execute app
78
79
start_app (config , get_proxy_logger ("test" ), one_shot = True )
79
80
80
- # tests
81
- process = subprocess .run (
82
- ["hg" , "export" , "tip" ],
83
- cwd = hg_remote_repo_path ,
84
- check = True ,
85
- capture_output = True ,
86
- text = True ,
87
- )
88
- assert "FOO CONTENT" in process .stdout
81
+ # test
82
+ assert "FOO CONTENT" in hg_export_tip (hg_remote_repo_path )
Original file line number Diff line number Diff line change 3
3
4
4
import pytest
5
5
from git import Repo
6
+ from utils import hg_export_tip
6
7
7
8
from git_hg_sync .__main__ import get_connection , get_queue
8
9
from git_hg_sync .config import TrackedRepository
@@ -41,14 +42,8 @@ def test_sync_process_(
41
42
syncrepos = RepoSynchronizer (git_local_repo_path , str (git_remote_repo_path ))
42
43
syncrepos .sync_branches (str (hg_remote_repo_path ), [(git_commit_sha , "foo" )])
43
44
44
- process = subprocess .run (
45
- ["hg" , "export" , "tip" ],
46
- cwd = hg_remote_repo_path ,
47
- check = True ,
48
- capture_output = True ,
49
- text = True ,
50
- )
51
- assert "FOO CONTENT" in process .stdout
45
+ # test
46
+ assert "FOO CONTENT" in hg_export_tip (hg_remote_repo_path )
52
47
53
48
54
49
def test_get_connection_and_queue (pulse_config ):
Original file line number Diff line number Diff line change
1
+ import subprocess
2
+
3
+
4
+ def hg_export_tip (repo_path : str ):
5
+ process = subprocess .run (
6
+ ["hg" , "export" , "tip" ],
7
+ cwd = repo_path ,
8
+ check = True ,
9
+ capture_output = True ,
10
+ text = True ,
11
+ )
12
+ return process .stdout
0 commit comments