Skip to content

Commit

Permalink
updated output paths for tests to use moduel name
Browse files Browse the repository at this point in the history
  • Loading branch information
cracked-machine committed Feb 4, 2024
1 parent 5d2ee10 commit 8a86913
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions tests/test_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import mmdiagram.generator
import pathlib

# Check the output report at /tmp/pytest/tests.test_args.md


def test_no_args():
with unittest.mock.patch('sys.argv',
Expand Down Expand Up @@ -42,7 +44,7 @@ def test_invalid_out_arg():
'0x10',
'0x10',
"-o",
"/tmp/custom/myreport.txt"]):
f"/tmp/pytest/{__name__}.txt"]):
with pytest.raises(NameError):
mmdiagram.generator.Diagram()

Expand Down Expand Up @@ -81,7 +83,7 @@ def test_valid_custom_out_arg():
'0x10',
'0x10',
"-o",
"/tmp/custom/myreport.md"]):
f"/tmp/pytest/{__name__}.md"]):
mmdiagram.generator.Diagram()
assert pathlib.Path("/tmp/custom/myreport.md").exists()
assert pathlib.Path("/tmp/custom/myreport.png").exists()
assert pathlib.Path(f"/tmp/pytest/{__name__}.md").exists()
assert pathlib.Path(f"/tmp/pytest/{__name__}.png").exists()
6 changes: 3 additions & 3 deletions tests/test_colours.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_no_more_colours_but_white():
'0x10',
'0x150',
"-o",
"/tmp/custom/dupecolours.md"]):
f"/tmp/pytest/{__name__}.md"]):
# deliberately restrict the dict len=1 so we can confirm the error is raised.
with unittest.mock.patch('mmdiagram.types.Region._remaining_colours',
{"white": "#000000"}):
Expand All @@ -42,7 +42,7 @@ def test_no_more_colours_but_black():
'0x10',
'0x150',
"-o",
"/tmp/custom/dupecolours.md"]):
f"/tmp/pytest/{__name__}.md"]):
# deliberately restrict the dict len=1 so we can confirm the error is raised.
with unittest.mock.patch('mmdiagram.types.Region._remaining_colours',
{"black": "#ffffff"}):
Expand All @@ -56,7 +56,7 @@ def test_only_one_lightslategr_y():
['mmap_digram.diagram',
'kernel', '0x10', '0x60',
'rootfs', '0x50', '0x10'
"-o", "/tmp/custom/onlytwocolours.md"],
"-o", f"/tmp/pytest/{__name__}.md"],
'mmdiagram.types.Region._remaining_colours',
{"lightslategray": "#778899", "lightslategrey": "#778899"}):
with pytest.raises(SystemExit):
Expand Down

0 comments on commit 8a86913

Please sign in to comment.