Skip to content

Commit

Permalink
Update tests in demo/broadway
Browse files Browse the repository at this point in the history
  • Loading branch information
slaclau committed Jul 17, 2024
1 parent 8a3da55 commit c093997
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 0 additions & 6 deletions test/demo/broadway/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
import subprocess


def pytest_runtest_setup(item):
print(f"pytest_runtest_setup({item}")


def pytest_configure(config):
print("Configure")
subprocess.run(["pkill", "gtk4-broadwayd"])
subprocess.Popen(["/usr/bin/gtk4-broadwayd", ":5"])
(pathlib.Path(__file__).parent / "results").mkdir(parents=True, exist_ok=True)


def pytest_unconfigure(config):
print("Unconfigure")
subprocess.run(["pkill", "gtk4-broadwayd"])
4 changes: 3 additions & 1 deletion test/demo/broadway/test_broadway.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def end():


@pytest.mark.parametrize("demo", chain(*demos.values()))
def test_demo(demo, browser):
def test_demo(demo, browser, capsys):
app = DemoApplication(
demo, browser, application_id=f"io.github.slaclau.plotly_gtk.{demo}"
)
Expand All @@ -88,6 +88,8 @@ def test_demo(demo, browser):
directory = (pathlib.Path(__file__).parent / "results").resolve()
img = Image.open(directory / f"{demo}.png")
assert np.mean(img.convert("RGB").getdata()) < 0xFF
out, err = capsys.readouterr()

Check warning on line 91 in test/demo/broadway/test_broadway.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

test/demo/broadway/test_broadway.py#L91

Unused variable 'out'
assert not err

if __name__ == "__main__":
if len(sys.argv) > 1:
Expand Down

0 comments on commit c093997

Please sign in to comment.