Skip to content

Commit 1f1e733

Browse files
committed
Add test for check_file_output
1 parent 5b08f43 commit 1f1e733

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

tests/test_testing.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@
55
import sys
66

77
# 3rd party
8+
import pytest
89
from _pytest.mark import Mark, MarkDecorator
10+
from pytest_regressions.file_regression import FileRegressionFixture
911

1012
# this package
1113
from domdf_python_tools import testing
1214
from domdf_python_tools.paths import PathPlus
13-
from domdf_python_tools.testing import not_macos, not_pypy, not_windows, only_macos, only_pypy, only_windows
15+
from domdf_python_tools.testing import (
16+
check_file_output,
17+
not_macos,
18+
not_pypy,
19+
not_windows,
20+
only_macos,
21+
only_pypy,
22+
only_windows
23+
)
1424
from domdf_python_tools.utils import strtobool
1525

1626

@@ -186,3 +196,11 @@ def test_only_macos():
186196
def test_tmp_pathplus(tmp_pathplus):
187197
assert isinstance(tmp_pathplus, PathPlus)
188198
assert tmp_pathplus.exists()
199+
200+
201+
def test_check_file_output(tmp_pathplus, file_regression: FileRegressionFixture):
202+
with pytest.raises(FileNotFoundError, match="No such file or directory: '.*'"):
203+
check_file_output(tmp_pathplus / "file.txt", file_regression)
204+
205+
(tmp_pathplus / "file.txt").write_text("Success!")
206+
check_file_output(tmp_pathplus / "file.txt", file_regression)

0 commit comments

Comments
 (0)