Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions fastwsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
import sys
import signal
import importlib
import importlib.util
import importlib.metadata
import click
import _fastwsgi
from pkg_resources import get_distribution

__version__ = get_distribution("fastwsgi").version
__version__ = importlib.metadata.version("fastwsgi")

LL_DISABLED = 0
LL_FATAL_ERROR = 1
Expand Down Expand Up @@ -121,7 +122,7 @@ def import_from_string(import_str):
# -------------------------------------------------------------------------------------

@click.command()
@click.version_option(version=get_distribution("fastwsgi").version, message="%(version)s")
@click.version_option(version=__version__, message="%(version)s")
@click.option("--host", help="Host the socket is bound to.", type=str, default=server.host, show_default=True)
@click.option("-p", "--port", help="Port the socket is bound to.", type=int, default=server.port, show_default=True)
@click.option("-l", "--loglevel", help="Logging level.", type=int, default=server.loglevel, show_default=True)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from click.testing import CliRunner
from pkg_resources import get_distribution
import importlib.metadata

from fastwsgi import run_from_cli

Expand All @@ -23,7 +23,7 @@ def test_help(self):
def test_version(self):
result = call_fastwsgi(parameters=["--version"])
assert result.exit_code == 0
assert result.output.strip() == get_distribution("fastwsgi").version
assert result.output.strip() == importlib.metadata.version("fastwsgi")

def test_run_from_cli_invalid_module(self):
result = call_fastwsgi(arguments=["module:wrong"])
Expand Down