pypas-cli 0.2.4__tar.gz → 0.2.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/PKG-INFO +1 -1
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/pyproject.toml +1 -1
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/exercise.py +7 -31
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/main.py +4 -6
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/PKG-INFO +1 -1
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/LICENSE +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/README.md +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/setup.cfg +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/__init__.py +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/auth.py +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/config.py +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/console.py +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/decorators.py +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/monads.py +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/network.py +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/sysutils.py +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/settings.py +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/SOURCES.txt +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/dependency_links.txt +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/entry_points.txt +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/requires.txt +0 -0
- {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/top_level.txt +0 -0
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import os
|
|
4
4
|
import re
|
|
5
5
|
import shutil
|
|
6
|
+
import subprocess
|
|
6
7
|
import tempfile
|
|
7
8
|
import zipfile
|
|
8
9
|
from pathlib import Path
|
|
@@ -116,14 +117,13 @@ class Exercise:
|
|
|
116
117
|
console.error(monad.payload)
|
|
117
118
|
zipfile.unlink(missing_ok=True)
|
|
118
119
|
|
|
119
|
-
def test(self):
|
|
120
|
-
if
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
Please [i]install dependencies[/i] (usually inside a virtualenv) and run: [note]pytest""")
|
|
120
|
+
def test(self, args: list[str]):
|
|
121
|
+
if test_cmd := self.config.get('test_cmd'):
|
|
122
|
+
test_cmd = f'{test_cmd} {" ".join(args)}' if args else test_cmd
|
|
123
|
+
console.info(f'Running tests with: [note]{test_cmd}[/note]')
|
|
124
|
+
subprocess.run(test_cmd, shell=True)
|
|
125
125
|
else:
|
|
126
|
-
pytest.main(args=
|
|
126
|
+
pytest.main(args=args)
|
|
127
127
|
|
|
128
128
|
@classmethod
|
|
129
129
|
def from_config(cls) -> Exercise:
|
|
@@ -147,30 +147,6 @@ Please [i]install dependencies[/i] (usually inside a virtualenv) and run: [note]
|
|
|
147
147
|
console.check()
|
|
148
148
|
return True
|
|
149
149
|
|
|
150
|
-
@staticmethod
|
|
151
|
-
def pytest_help():
|
|
152
|
-
console.info('[note]pypas test[/note] is just a wrapper for [note]pytest[/note]')
|
|
153
|
-
console.info(
|
|
154
|
-
'You can find documentation on how to invoke pytest at: [warning]https://docs.pytest.org/en/latest/how-to/usage.html'
|
|
155
|
-
)
|
|
156
|
-
console.debug('Here you have some of the more useful options:')
|
|
157
|
-
|
|
158
|
-
table = CustomTable(('Command', 'quote'), 'Description')
|
|
159
|
-
table.add_row('pytest -x', 'Exit instantly on first error or failed test.')
|
|
160
|
-
table.add_row(
|
|
161
|
-
'pytest -k <expression>',
|
|
162
|
-
'Only run tests which match the given substring expression.',
|
|
163
|
-
)
|
|
164
|
-
table.add_row('pytest -v', 'Increase verbosity.')
|
|
165
|
-
table.add_row('pytest -q', 'Decrease verbosity.')
|
|
166
|
-
table.add_row('pytest --lf', 'Rerun only the tests that failed at the last run.')
|
|
167
|
-
table.add_row(
|
|
168
|
-
'pytest --sw',
|
|
169
|
-
'Exit on test failure and continue from last failing test next time.',
|
|
170
|
-
)
|
|
171
|
-
table.add_row('pytest <path/to>::<test>', 'Run specific test.')
|
|
172
|
-
console.print(table)
|
|
173
|
-
|
|
174
150
|
@staticmethod
|
|
175
151
|
def log(token: str, frame_ref: str, verbose: bool = False) -> None:
|
|
176
152
|
url = settings.PYPAS_LOG_URLPATH
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
|
+
from typing import List
|
|
2
3
|
|
|
3
4
|
import typer
|
|
4
5
|
from rich.prompt import Confirm
|
|
@@ -121,17 +122,14 @@ def put():
|
|
|
121
122
|
exercise.upload(zipfile, config['token'])
|
|
122
123
|
|
|
123
124
|
|
|
124
|
-
@app.command()
|
|
125
|
+
@app.command(context_settings={'ignore_unknown_options': True})
|
|
125
126
|
@inside_exercise
|
|
126
127
|
def test(
|
|
127
|
-
|
|
128
|
+
args: List[str] = typer.Argument(None, help='Arguments passed to test tool'),
|
|
128
129
|
):
|
|
129
130
|
"""Test exercise."""
|
|
130
131
|
exercise = Exercise.from_config()
|
|
131
|
-
|
|
132
|
-
exercise.pytest_help()
|
|
133
|
-
else:
|
|
134
|
-
exercise.test()
|
|
132
|
+
exercise.test(args or [])
|
|
135
133
|
|
|
136
134
|
|
|
137
135
|
@app.command()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|