Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion tests/pulse_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def send_pulse_message(pulse_config, payload, purge=False):

if __name__ == "__main__":
config = Config.from_file(HERE.parent / "config.toml")
config.mappings
message_type = sys.argv[1]
match message_type:
case "push":
Expand Down
14 changes: 4 additions & 10 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import pytest
from git import Repo
from mozlog import get_proxy_logger
from utils import hg_export_tip

from git_hg_sync.__main__ import get_connection, get_queue, start_app
from git_hg_sync.config import Config

NO_RABBITMQ = not (os.getenv("RABBITMQ") == "true")
NO_RABBITMQ = not os.getenv("RABBITMQ") == "true"
HERE = Path(__file__).parent


Expand Down Expand Up @@ -77,12 +78,5 @@ def test_full_app(
# execute app
start_app(config, get_proxy_logger("test"), one_shot=True)

# tests
process = subprocess.run(
["hg", "export", "tip"],
cwd=hg_remote_repo_path,
check=True,
capture_output=True,
text=True,
)
assert "FOO CONTENT" in process.stdout
# test
assert "FOO CONTENT" in hg_export_tip(hg_remote_repo_path)
11 changes: 3 additions & 8 deletions tests/test_repo_synchronizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest
from git import Repo
from utils import hg_export_tip

from git_hg_sync.__main__ import get_connection, get_queue
from git_hg_sync.config import TrackedRepository
Expand Down Expand Up @@ -41,14 +42,8 @@ def test_sync_process_(
syncrepos = RepoSynchronizer(git_local_repo_path, str(git_remote_repo_path))
syncrepos.sync_branches(str(hg_remote_repo_path), [(git_commit_sha, "foo")])

process = subprocess.run(
["hg", "export", "tip"],
cwd=hg_remote_repo_path,
check=True,
capture_output=True,
text=True,
)
assert "FOO CONTENT" in process.stdout
# test
assert "FOO CONTENT" in hg_export_tip(hg_remote_repo_path)


def test_get_connection_and_queue(pulse_config):
Expand Down
12 changes: 12 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import subprocess


def hg_export_tip(repo_path: str):
process = subprocess.run(
["hg", "export", "tip"],
cwd=repo_path,
check=True,
capture_output=True,
text=True,
)
return process.stdout