Skip to content

Commit

Permalink
Added test for setuptools startup
Browse files Browse the repository at this point in the history
  • Loading branch information
wfondrie committed Mar 19, 2021
1 parent 4dee641 commit 77f3c5f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 1 addition & 3 deletions mokapot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Initialize the mokapot package.
"""
"""Initialize the mokapot package."""
try:
from importlib.metadata import version, PackageNotFoundError

Expand Down
18 changes: 18 additions & 0 deletions tests/unit_tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Test that getting the version works"""


def test_importlib():
"""This is the fast way for Python 3.8+"""
import mokapot

assert mokapot.__version__ != "0.0.0"


def test_setuptools():
"""We use this for Python < 3.8"""
import sys

sys.modules["importlib.metadata"] = None
import mokapot

assert mokapot.__version__ != "0.0.0"

0 comments on commit 77f3c5f

Please sign in to comment.