Skip to content

Commit 9e8a5d7

Browse files
fix: help page for sub command "environment" on windows (#805)
fixes #804 --------- Signed-off-by: Steve (Gadget) Barnes <[email protected]> Signed-off-by: Jan Kowalleck <[email protected]> Co-authored-by: Jan Kowalleck <[email protected]>
1 parent c7b5b1a commit 9e8a5d7

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

cyclonedx_py/_internal/environment.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,23 @@ def make_argument_parser(**kwargs: Any) -> 'ArgumentParser':
6464
> %(prog)s "...\\some\\path\\bin\\python.exe"
6565
> %(prog)s "...\\some\\path\\.venv"
6666
> %(prog)s "$env:VIRTUAL_ENV"
67-
> %(prog)s %VIRTUAL_ENV%
67+
> %(prog)s %%VIRTUAL_ENV%%
6868
• Build an SBOM from specific Python environment:
6969
> where.exe python3.9.exe
70-
> %(prog)s "%path-to-specific-python%"
70+
> %(prog)s "%%path-to-specific-python%%"
7171
• Build an SBOM from conda Python environment:
7272
> conda.exe run where.exe python
73-
> %(prog)s "%path-to-conda-python%"
73+
> %(prog)s "%%path-to-conda-python%%"
7474
• Build an SBOM from Pipenv environment:
7575
> pipenv.exe --py
7676
> pipenv.exe --venv
77-
> %(prog)s "%path-to-pipenv-python%"
77+
> %(prog)s "%%path-to-pipenv-python%%"
7878
• Build an SBOM from Poetry environment:
7979
> poetry.exe env info --executable
80-
> %(prog)s "%path-to-poetry-python%"
80+
> %(prog)s "%%path-to-poetry-python%%"
8181
• Build an SBOM from PDM environment:
8282
> pdm.exe info --python
83-
> %(prog)s "%path-to-pdm-python%"
83+
> %(prog)s "%%path-to-pdm-python%%"
8484
""")
8585
else: # if os_name == 'posix':
8686
p.epilog = dedent("""\

tests/integration/test_cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,7 @@ def test_version(self) -> None:
3939
res, out, err = run_cli('--version')
4040
self.assertEqual(0, res, '\n'.join((out, err)))
4141
self.assertIn(__version__, out)
42+
43+
def test_help(self) -> None:
44+
res, out, err = run_cli('--help')
45+
self.assertEqual(0, res, '\n'.join((out, err)))

tests/integration/test_cli_environment.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def test_data_file_filter(s: str) -> Generator[Any, None, None]:
4545
@ddt
4646
class TestCliEnvironment(TestCase, SnapshotMixin):
4747

48+
def test_help(self) -> None:
49+
res, out, err = run_cli('environment', '--help')
50+
self.assertEqual(0, res, '\n'.join((out, err)))
51+
4852
@classmethod
4953
def __setup_testbeds_init(cls) -> None:
5054
for initfile in initfiles:

tests/integration/test_cli_pipenv.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def test_data_file_filter(s: str) -> Generator[Any, None, None]:
4545
@ddt
4646
class TestCliPipenv(TestCase, SnapshotMixin):
4747

48+
def test_help(self) -> None:
49+
res, out, err = run_cli('pipenv', '--help')
50+
self.assertEqual(0, res, '\n'.join((out, err)))
51+
4852
def test_fails_with_dir_not_found(self) -> None:
4953
_, projectdir, sv, of = random.choice(test_data) # nosec B311
5054
res, out, err = run_cli(

tests/integration/test_cli_poetry.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ def test_data_file_filter(s: str) -> Generator[Any, None, None]:
4545
@ddt
4646
class TestCliPoetry(TestCase, SnapshotMixin):
4747

48+
def test_help(self) -> None:
49+
res, out, err = run_cli('poetry', '--help')
50+
self.assertEqual(0, res, '\n'.join((out, err)))
51+
4852
def test_fails_with_dir_not_found(self) -> None:
4953
_, projectdir, sv, of = random.choice(test_data) # nosec B311
5054
res, out, err = run_cli(

tests/integration/test_cli_requirements.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ def test_data_os_filter(data: Tuple[Any, str, Any, Any]) -> bool:
5656
@ddt
5757
class TestCliRequirements(TestCase, SnapshotMixin):
5858

59+
def test_help(self) -> None:
60+
res, out, err = run_cli('requirements', '--help')
61+
self.assertEqual(0, res, '\n'.join((out, err)))
62+
5963
def test_with_file_not_found(self) -> None:
6064
_, infile, sv, of = random.choice(test_data) # nosec B311
6165
res, out, err = run_cli(

0 commit comments

Comments
 (0)