Skip to content

Commit

Permalink
print zot stdout not capture by pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincinator committed Aug 15, 2024
1 parent b6955aa commit 38df5a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pytests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
- name: serve zot
run: zot serve zot/config.json
- name: Run tests with pytest
run: poetry run pytest
run: pytest -s

17 changes: 3 additions & 14 deletions tests/test_push_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def write_zot_config(config_dict, file_path):
with open(file_path, "w") as config_file:
json.dump(config_dict, config_file, indent=4)


@pytest.fixture(autouse=True)
def setup_test_environment():
zot_config = {
"distSpecVersion": "1.1.0",
Expand All @@ -31,6 +33,7 @@ def setup_test_environment():
with tempfile.NamedTemporaryFile(delete=False, suffix=".json") as temp_config_file:
write_zot_config(zot_config, temp_config_file.name)
zot_config_file_path = temp_config_file.name

print(f"Spawning zot registry with config {zot_config_file_path}")
zot_process = spawn_background_process(
f"zot serve {zot_config_file_path}",
Expand All @@ -40,20 +43,6 @@ def setup_test_environment():

yield zot_process

if zot_process.stdout:
print("Zot stdout:")
for line in io.TextIOWrapper(zot_process.stdout, encoding="utf-8"):
print(line)
else:
print("Not capture any zot stdout")

if zot_process.stderr:
print("Zot stderr:")
for line in io.TextIOWrapper(zot_process.stderr, encoding="utf-8"):
print(line)
else:
print("Not capture any zot stderr")

zot_process.terminate()

if os.path.isdir("./output"):
Expand Down

0 comments on commit 38df5a3

Please sign in to comment.