mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-01-18 18:40:47 +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)
|
[![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)
|
[![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
|
# VBAN CMD
|
||||||
|
|
||||||
|
19
setup.py
19
setup.py
@ -1,17 +1,10 @@
|
|||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='vbancmd',
|
name="vbancmd",
|
||||||
version='0.0.1',
|
version="0.0.1",
|
||||||
description='VBAN CMD Python API',
|
description="VBAN CMD Python API",
|
||||||
packages=['vbancmd'],
|
packages=["vbancmd"],
|
||||||
install_requires=[
|
install_requires=["toml"],
|
||||||
'toml'
|
extras_require={"development": ["pytest", "pytest-randomly", "genbadge[tests]"]},
|
||||||
],
|
|
||||||
extras_require={
|
|
||||||
'development': [
|
|
||||||
"pytest",
|
|
||||||
"pytest-randomly",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
@ -2,10 +2,10 @@ from dataclasses import dataclass
|
|||||||
import vbancmd
|
import vbancmd
|
||||||
from vbancmd import kinds
|
from vbancmd import kinds
|
||||||
import random
|
import random
|
||||||
|
import sys
|
||||||
|
|
||||||
# let's keep things random
|
# let's keep things random
|
||||||
# kind_id = random.choice(("basic", "banana", "potato"))
|
kind_id = random.choice(("basic", "banana", "potato"))
|
||||||
kind_id = "banana"
|
|
||||||
|
|
||||||
opts = {
|
opts = {
|
||||||
"ip": "codey.local",
|
"ip": "codey.local",
|
||||||
@ -39,6 +39,7 @@ data = Data()
|
|||||||
|
|
||||||
|
|
||||||
def setup_module():
|
def setup_module():
|
||||||
|
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
||||||
tests.login()
|
tests.login()
|
||||||
tests.apply_profile("blank")
|
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