Skip to content

Commit

Permalink
Remove usage of deprecated pkg_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
mbovo committed Jun 4, 2024
1 parent 7317d5d commit bcafeb8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/pdh/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import click
import pkg_resources
import importlib.metadata
import sys
import re
import os
Expand Down Expand Up @@ -56,7 +56,7 @@ def config(config):

@main.command(help="Print cloud tools version and exit")
def version():
click.echo(f"v{pkg_resources.get_distribution('pdh').version}")
click.echo(f"v{importlib.metadata.version('pdh')}")


@main.group(help="Operater on Users")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from rich.console import Console
from pdh import main
from click import testing
import pkg_resources
import importlib.metadata


def test_assert_true():
Expand All @@ -34,7 +34,7 @@ def test_main_version():
runner = testing.CliRunner()
result = runner.invoke(main.main, "version")
assert result.exit_code == 0
assert result.stdout == f"v{pkg_resources.get_distribution('pdh').version}\n"
assert result.stdout == f"v{importlib.metadata.version('pdh')}\n"


def test_print_items_table():
Expand Down

0 comments on commit bcafeb8

Please sign in to comment.