Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare number of created files with number of fixtures #1820

Merged
merged 1 commit into from
Jan 29, 2025
Merged
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
4 changes: 3 additions & 1 deletion tests/test_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def run_callback(tmpdir, report_type, vcrmode):
run = run_playbook_callback(tmpdir, report_type)
assert run.rc == 0
assert len(tmpdir.listdir()) > 0, "Directory with results is empty"
fixture_directory = os.path.join(os.getcwd(), 'tests', 'fixtures', 'callback', 'dir_store', report_type)
assert len(tmpdir.listdir()) == len(os.listdir(fixture_directory)), "Fixture directory and output directory have a different number of files"
for real_file in tmpdir.listdir(sort=True):
contents = real_file.read()
contents = re.sub(r"\d+-\d+-\d+ \d+:\d+:\d+\+\d+:\d+", "2000-01-01 12:00:00+00:00", contents)
Expand All @@ -80,7 +82,7 @@ def run_callback(tmpdir, report_type, vcrmode):
real_contents['metrics']['time']['total'] = 1
real_contents = drop_incompatible_items(real_contents)
fixture_name = real_file.basename
fixture = os.path.join(os.getcwd(), 'tests', 'fixtures', 'callback', 'dir_store', report_type, fixture_name)
fixture = os.path.join(fixture_directory, fixture_name)
if vcrmode == "record":
print("Writing: ", str(fixture))
with open(fixture, 'w') as f:
Expand Down
Loading