mirror of
				https://github.com/onyx-and-iris/vban-cmd-python.git
				synced 2025-10-31 05:31:45 +00:00 
			
		
		
		
	add poetry test scripts for each kind
This commit is contained in:
		
							parent
							
								
									a635109308
								
							
						
					
					
						commit
						0f2fb7121d
					
				| @ -28,7 +28,10 @@ build-backend = "poetry.core.masonry.api" | ||||
| gui = "scripts:ex_gui" | ||||
| obs = "scripts:ex_obs" | ||||
| observer = "scripts:ex_observer" | ||||
| test = "scripts:test" | ||||
| basic = "scripts:test_basic" | ||||
| banana = "scripts:test_banana" | ||||
| potato = "scripts:test_potato" | ||||
| all = "scripts:test_all" | ||||
| 
 | ||||
| [tool.tox] | ||||
| legacy_tox_ini = """ | ||||
|  | ||||
							
								
								
									
										19
									
								
								scripts.py
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								scripts.py
									
									
									
									
									
								
							| @ -1,3 +1,4 @@ | ||||
| import os | ||||
| import subprocess | ||||
| import sys | ||||
| from pathlib import Path | ||||
| @ -18,5 +19,21 @@ def ex_observer(): | ||||
|     subprocess.run([sys.executable, str(scriptpath)]) | ||||
| 
 | ||||
| 
 | ||||
| def test(): | ||||
| def test_basic(): | ||||
|     os.environ["KIND"] = "basic" | ||||
|     subprocess.run(["tox"]) | ||||
| 
 | ||||
| 
 | ||||
| def test_banana(): | ||||
|     os.environ["KIND"] = "banana" | ||||
|     subprocess.run(["tox"]) | ||||
| 
 | ||||
| 
 | ||||
| def test_potato(): | ||||
|     os.environ["KIND"] = "potato" | ||||
|     subprocess.run(["tox"]) | ||||
| 
 | ||||
| 
 | ||||
| def test_all(): | ||||
|     steps = [test_basic, test_banana, test_potato] | ||||
|     [step() for step in steps] | ||||
|  | ||||
| @ -1,3 +1,4 @@ | ||||
| import os | ||||
| import random | ||||
| import sys | ||||
| from dataclasses import dataclass | ||||
| @ -6,8 +7,10 @@ import vban_cmd | ||||
| from vban_cmd.kinds import KindId | ||||
| from vban_cmd.kinds import request_kind_map as kindmap | ||||
| 
 | ||||
| # let's keep things random | ||||
| KIND_ID = random.choice(tuple(kind_id.name.lower() for kind_id in KindId)) | ||||
| # get KIND_ID from env var, otherwise set to random | ||||
| KIND_ID = os.environ.get( | ||||
|     "KIND", random.choice(tuple(kind_id.name.lower() for kind_id in KindId)) | ||||
| ) | ||||
| 
 | ||||
| opts = { | ||||
|     "ip": "testing.local", | ||||
|  | ||||
| @ -11,7 +11,7 @@ Function RunTests { | ||||
|             $line | Tee-Object -FilePath $coverage -Append | ||||
|         } | ||||
|     } | ||||
|     Write-Output "$(Get-TimeStamp)" | Out-file $coverage -Append | ||||
|     Write-Output "$(Get-TimeStamp)" | Out-File $coverage -Append | ||||
| 
 | ||||
|     Invoke-Expression "genbadge tests -t 90 -i ./tests/.coverage.xml -o ./tests/$kind.svg" | ||||
| } | ||||
| @ -25,7 +25,10 @@ Function Get-TimeStamp { | ||||
| if ($MyInvocation.InvocationName -ne ".") { | ||||
|     Invoke-Expression ".\.venv\Scripts\Activate.ps1" | ||||
| 
 | ||||
|     RunTests | ||||
|     @("potato") | ForEach-Object { | ||||
|         $env:KIND = $_ | ||||
|         RunTests         | ||||
|     } | ||||
| 
 | ||||
|     Invoke-Expression "deactivate" | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user