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.
Files changed (22) hide show
  1. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/PKG-INFO +1 -1
  2. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/pyproject.toml +1 -1
  3. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/exercise.py +7 -31
  4. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/main.py +4 -6
  5. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/PKG-INFO +1 -1
  6. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/LICENSE +0 -0
  7. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/README.md +0 -0
  8. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/setup.cfg +0 -0
  9. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/__init__.py +0 -0
  10. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/auth.py +0 -0
  11. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/config.py +0 -0
  12. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/console.py +0 -0
  13. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/decorators.py +0 -0
  14. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/monads.py +0 -0
  15. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/network.py +0 -0
  16. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/lib/sysutils.py +0 -0
  17. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas/settings.py +0 -0
  18. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/SOURCES.txt +0 -0
  19. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/dependency_links.txt +0 -0
  20. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/entry_points.txt +0 -0
  21. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/requires.txt +0 -0
  22. {pypas_cli-0.2.4 → pypas_cli-0.2.6}/src/pypas_cli.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypas-cli
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Python Practical Assignments
5
5
  Author-email: Sergio Delgado Quintero <sdelquin@gmail.com>
6
6
  Maintainer-email: Sergio Delgado Quintero <sdelquin@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pypas-cli"
3
- version = "0.2.4"
3
+ version = "0.2.6"
4
4
  description = "Python Practical Assignments"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -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 Path('requirements.txt').exists():
121
- console.print("""[red]Attention[/red]
122
- A [i]requirements.txt[/i] file is detected in the current directory!
123
- pypas is not able to directly test this exercise.
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
- help: bool = typer.Option(False, '--help', '-h', help='Show test options.'),
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
- if help:
132
- exercise.pytest_help()
133
- else:
134
- exercise.test()
132
+ exercise.test(args or [])
135
133
 
136
134
 
137
135
  @app.command()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pypas-cli
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Python Practical Assignments
5
5
  Author-email: Sergio Delgado Quintero <sdelquin@gmail.com>
6
6
  Maintainer-email: Sergio Delgado Quintero <sdelquin@gmail.com>
File without changes
File without changes
File without changes