Skip to content

Commit

Permalink
Merge pull request #93 from CarliJoy/chore
Browse files Browse the repository at this point in the history
Chore: some little fixups
  • Loading branch information
CarliJoy authored Oct 1, 2023
2 parents 6377ad4 + fe83d91 commit 656f303
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 52 deletions.
16 changes: 0 additions & 16 deletions makefile

This file was deleted.

22 changes: 1 addition & 21 deletions manage.py
Original file line number Diff line number Diff line change
@@ -1,21 +1 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "RoWoOekostromDB.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == "__main__":
main()
# This file seems to be required for pytest-django to work properly
12 changes: 5 additions & 7 deletions src/django_pint/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import sys

if sys.version_info[:2] >= (3, 8):
# TODO: Import directly (no need for conditional) when `python_requires = >= 3.8`
from importlib.metadata import PackageNotFoundError, version # pragma: no cover
else:
from importlib_metadata import PackageNotFoundError, version # pragma: no cover
from importlib.metadata import PackageNotFoundError, version

try:
# Change here if project is renamed and does not equal the package name
Expand All @@ -14,3 +8,7 @@
__version__ = "unknown"
finally:
del version, PackageNotFoundError

from quantityfield import fields, helper, settings, units, widgets

__all__ = ["fields", "helper", "settings", "units", "widgets"]
10 changes: 4 additions & 6 deletions src/quantityfield/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import PackageNotFoundError, version

try:
# Change here if project is renamed and does not equal the package name
dist_name = "django-pint"
__version__ = get_distribution(dist_name).version
except DistributionNotFound: # pragma: no cover
# We don't expect this to be executed, as this would mean the configuration
# for the python module is wrong
__version__ = version(dist_name)
except PackageNotFoundError: # pragma: no cover
__version__ = "unknown"
finally:
del get_distribution, DistributionNotFound
del version, PackageNotFoundError
3 changes: 1 addition & 2 deletions src/quantityfield/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from pint import Quantity
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union, cast

from quantityfield.helper import check_matching_unit_dimension

from .helper import check_matching_unit_dimension
from .units import ureg
from .widgets import QuantityWidget

Expand Down
14 changes: 14 additions & 0 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import django_pint
import quantityfield


def test_version_import_quantityfield() -> None:
"""The quantityfield version is a defined version"""
assert quantityfield.__version__ != "unknown"
assert quantityfield.__version__[0].isnumeric()


def test_version_import_django_pint() -> None:
"""The django_pint version is a defined version"""
assert django_pint.__version__ != "unknown"
assert django_pint.__version__[0].isnumeric()

0 comments on commit 656f303

Please sign in to comment.