Skip to content

Commit

Permalink
Fix file-path comparison for windows
Browse files Browse the repository at this point in the history
TIL windows still uses the DOS-like slashes for paths.
  • Loading branch information
Hugo Osvaldo Barrera committed Aug 18, 2020
1 parent e6a2216 commit c65123b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ def test_generate_without_output():


def test_generate_with_file():
with open(f"{TESTPATH}/generate_with_file.jpeg", "wb") as f:
with open(os.path.join(TESTPATH, "generate_with_file.jpeg"), "wb") as f:
barcode.generate("ean13", "123455559121112", output=f)


def test_generate_with_filepath():
# FIXME: extension is added to the filepath even if you include it.
rv = barcode.generate(
"ean13", "123455559121112", output=f"{TESTPATH}/generate_with_filepath"
"ean13",
"123455559121112",
output=os.path.join(TESTPATH, "generate_with_filepath"),
)
assert rv == os.path.abspath(f"{TESTPATH}/generate_with_filepath.svg")
assert rv == os.path.abspath(os.path.join(TESTPATH, "generate_with_filepath.svg"))


def test_generate_with_file_and_writer():
with open(f"{TESTPATH}/generate_with_file_and_writer.jpeg", "wb") as f:
with open(os.path.join(TESTPATH, "generate_with_file_and_writer.jpeg"), "wb") as f:
barcode.generate("ean13", "123455559121112", output=f, writer=SVGWriter())


Expand Down

0 comments on commit c65123b

Please sign in to comment.