mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-01-18 02:20:48 +00:00
add pre-commit hook
keep tests random print kind.name to pytest output add genbadge to dev dependencies add test badges to readme
This commit is contained in:
parent
f55d86514c
commit
596e7465fb
@ -1,5 +1,8 @@
|
||||
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/onyx-and-iris/vban-cmd-python/blob/dev/LICENSE)
|
||||
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
|
||||
![Tests Status](./tests/basic.svg?dummy=8484744)
|
||||
![Tests Status](./tests/banana.svg?dummy=8484744)
|
||||
![Tests Status](./tests/potato.svg?dummy=8484744)
|
||||
|
||||
# VBAN CMD
|
||||
|
||||
|
19
setup.py
19
setup.py
@ -1,17 +1,10 @@
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name='vbancmd',
|
||||
version='0.0.1',
|
||||
description='VBAN CMD Python API',
|
||||
packages=['vbancmd'],
|
||||
install_requires=[
|
||||
'toml'
|
||||
],
|
||||
extras_require={
|
||||
'development': [
|
||||
"pytest",
|
||||
"pytest-randomly",
|
||||
]
|
||||
}
|
||||
name="vbancmd",
|
||||
version="0.0.1",
|
||||
description="VBAN CMD Python API",
|
||||
packages=["vbancmd"],
|
||||
install_requires=["toml"],
|
||||
extras_require={"development": ["pytest", "pytest-randomly", "genbadge[tests]"]},
|
||||
)
|
||||
|
@ -2,10 +2,10 @@ from dataclasses import dataclass
|
||||
import vbancmd
|
||||
from vbancmd import kinds
|
||||
import random
|
||||
import sys
|
||||
|
||||
# let's keep things random
|
||||
# kind_id = random.choice(("basic", "banana", "potato"))
|
||||
kind_id = "banana"
|
||||
kind_id = random.choice(("basic", "banana", "potato"))
|
||||
|
||||
opts = {
|
||||
"ip": "codey.local",
|
||||
@ -39,6 +39,7 @@ data = Data()
|
||||
|
||||
|
||||
def setup_module():
|
||||
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
||||
tests.login()
|
||||
tests.apply_profile("blank")
|
||||
|
||||
|
31
tests/pre-commit.ps1
Normal file
31
tests/pre-commit.ps1
Normal file
@ -0,0 +1,31 @@
|
||||
Function RunTests {
|
||||
$coverage = "./tests/pytest_coverage.log"
|
||||
$run_tests = "pytest -v --capture=tee-sys --junitxml=./tests/.coverage.xml"
|
||||
$match_pattern = "^=|^\s*$|^Running|^Using|^plugins|^collecting|^tests"
|
||||
|
||||
Clear-Content $coverage
|
||||
|
||||
ForEach ($line in $(Invoke-Expression $run_tests)) {
|
||||
If ( $line -Match $match_pattern ) {
|
||||
if ( $line -Match "^Running tests for kind \[(\w+)\]" ) { $kind = $Matches[1] }
|
||||
$line | Tee-Object -FilePath $coverage -Append
|
||||
}
|
||||
}
|
||||
Write-Output "$(Get-TimeStamp)" | Out-file $coverage -Append
|
||||
|
||||
Invoke-Expression "genbadge tests -t 90 -i ./tests/.coverage.xml -o ./tests/$kind.svg"
|
||||
}
|
||||
|
||||
Function Get-TimeStamp {
|
||||
|
||||
return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)
|
||||
|
||||
}
|
||||
|
||||
if ($MyInvocation.InvocationName -ne ".") {
|
||||
Invoke-Expression ".\venv\Scripts\Activate.ps1"
|
||||
|
||||
RunTests
|
||||
|
||||
Invoke-Expression "deactivate"
|
||||
}
|
Loading…
Reference in New Issue
Block a user