generated from mscheltienne/template-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d88210
commit 95088a4
Showing
9 changed files
with
63 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from __future__ import annotations | ||
|
||
import click | ||
|
||
from .sys_info import run as sys_info | ||
|
||
|
||
@click.group() | ||
def run() -> None: | ||
"""Main package entry-point.""" # noqa: D401 | ||
|
||
|
||
run.add_command(sys_info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
import argparse | ||
from __future__ import annotations | ||
|
||
import click | ||
|
||
from .. import sys_info | ||
|
||
|
||
def run() -> None: | ||
@click.command(name="sys-info") | ||
@click.option( | ||
"--developer", | ||
help="Display information for optional dependencies.", | ||
is_flag=True, | ||
) | ||
def run(developer: bool) -> None: | ||
"""Run sys_info() command.""" | ||
parser = argparse.ArgumentParser( | ||
prog=f"{__package__.split('.')[0]}-sys_info", description="sys_info" | ||
) | ||
parser.add_argument( | ||
"--developer", | ||
help="display information for optional dependencies", | ||
action="store_true", | ||
) | ||
args = parser.parse_args() | ||
|
||
sys_info(developer=args.developer) | ||
sys_info(developer=developer) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from click.testing import CliRunner | ||
|
||
from ..main import run | ||
|
||
|
||
def test_main(): | ||
"""Test the main package entry-point.""" | ||
runner = CliRunner() | ||
result = runner.invoke(run) | ||
assert result.exit_code == 0 | ||
assert "Main package entry-point" in result.output | ||
assert "Options:" in result.output | ||
assert "Commands:" in result.output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
from click.testing import CliRunner | ||
|
||
from ..sys_info import run | ||
|
||
|
||
@pytest.mark.parametrize("developer", [False, True]) | ||
def test_sys_info(developer: bool): | ||
"""Test the system information entry-point.""" | ||
runner = CliRunner() | ||
result = runner.invoke(run, ["--developer"] if developer else []) | ||
assert result.exit_code == 0 | ||
assert "Platform:" in result.output | ||
assert "Python:" in result.output | ||
assert "Executable:" in result.output | ||
assert "Core dependencies" in result.output | ||
if developer: | ||
assert "Optional 'build' dependencies" in result.output | ||
assert "Optional 'style' dependencies" in result.output | ||
assert "Optional 'test' dependencies" in result.output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters