Skip to content

Commit

Permalink
fix: help page for sub command "environment" on windows (#805)
Browse files Browse the repository at this point in the history
fixes #804

---------

Signed-off-by: Steve (Gadget) Barnes <[email protected]>
Signed-off-by: Jan Kowalleck <[email protected]>
Co-authored-by: Jan Kowalleck <[email protected]>
  • Loading branch information
GadgetSteve and jkowalleck authored Sep 30, 2024
1 parent c7b5b1a commit 9e8a5d7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cyclonedx_py/_internal/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
> %(prog)s "...\\some\\path\\bin\\python.exe"
> %(prog)s "...\\some\\path\\.venv"
> %(prog)s "$env:VIRTUAL_ENV"
> %(prog)s %VIRTUAL_ENV%
> %(prog)s %%VIRTUAL_ENV%%
• Build an SBOM from specific Python environment:
> where.exe python3.9.exe
> %(prog)s "%path-to-specific-python%"
> %(prog)s "%%path-to-specific-python%%"
• Build an SBOM from conda Python environment:
> conda.exe run where.exe python
> %(prog)s "%path-to-conda-python%"
> %(prog)s "%%path-to-conda-python%%"
• Build an SBOM from Pipenv environment:
> pipenv.exe --py
> pipenv.exe --venv
> %(prog)s "%path-to-pipenv-python%"
> %(prog)s "%%path-to-pipenv-python%%"
• Build an SBOM from Poetry environment:
> poetry.exe env info --executable
> %(prog)s "%path-to-poetry-python%"
> %(prog)s "%%path-to-poetry-python%%"
• Build an SBOM from PDM environment:
> pdm.exe info --python
> %(prog)s "%path-to-pdm-python%"
> %(prog)s "%%path-to-pdm-python%%"
""")
else: # if os_name == 'posix':
p.epilog = dedent("""\
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ def test_version(self) -> None:
res, out, err = run_cli('--version')
self.assertEqual(0, res, '\n'.join((out, err)))
self.assertIn(__version__, out)

def test_help(self) -> None:
res, out, err = run_cli('--help')
self.assertEqual(0, res, '\n'.join((out, err)))
4 changes: 4 additions & 0 deletions tests/integration/test_cli_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def test_data_file_filter(s: str) -> Generator[Any, None, None]:
@ddt
class TestCliEnvironment(TestCase, SnapshotMixin):

def test_help(self) -> None:
res, out, err = run_cli('environment', '--help')
self.assertEqual(0, res, '\n'.join((out, err)))

@classmethod
def __setup_testbeds_init(cls) -> None:
for initfile in initfiles:
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/test_cli_pipenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def test_data_file_filter(s: str) -> Generator[Any, None, None]:
@ddt
class TestCliPipenv(TestCase, SnapshotMixin):

def test_help(self) -> None:
res, out, err = run_cli('pipenv', '--help')
self.assertEqual(0, res, '\n'.join((out, err)))

def test_fails_with_dir_not_found(self) -> None:
_, projectdir, sv, of = random.choice(test_data) # nosec B311
res, out, err = run_cli(
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/test_cli_poetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def test_data_file_filter(s: str) -> Generator[Any, None, None]:
@ddt
class TestCliPoetry(TestCase, SnapshotMixin):

def test_help(self) -> None:
res, out, err = run_cli('poetry', '--help')
self.assertEqual(0, res, '\n'.join((out, err)))

def test_fails_with_dir_not_found(self) -> None:
_, projectdir, sv, of = random.choice(test_data) # nosec B311
res, out, err = run_cli(
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/test_cli_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ def test_data_os_filter(data: Tuple[Any, str, Any, Any]) -> bool:
@ddt
class TestCliRequirements(TestCase, SnapshotMixin):

def test_help(self) -> None:
res, out, err = run_cli('requirements', '--help')
self.assertEqual(0, res, '\n'.join((out, err)))

def test_with_file_not_found(self) -> None:
_, infile, sv, of = random.choice(test_data) # nosec B311
res, out, err = run_cli(
Expand Down

0 comments on commit 9e8a5d7

Please sign in to comment.