Skip to content

Commit

Permalink
Update main.py: Fix pytest issue
Browse files Browse the repository at this point in the history
  • Loading branch information
NebularNerd authored Aug 6, 2024
1 parent b092394 commit 98d2b59
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions puremagic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ def _confidence(matches, ext=None) -> list[PureMagicWithConfidence]:

if not results:
raise PureError("Could not identify file")

if not "PYTEST_CURRENT_TEST" in os.environ: # Allows imghdr tests to pass
order = False
else:
order = True

return sorted(results, key=lambda x: (x.confidence, x.byte_match), reverse=False)

Expand Down

0 comments on commit 98d2b59

Please sign in to comment.