chore: setup example for pytest
This commit is contained in:
		
							parent
							
								
									97a51af7cf
								
							
						
					
					
						commit
						4f4f0fb3f5
					
				|  | @ -31,6 +31,8 @@ repos: | ||||||
|       rev: 1.7.10 |       rev: 1.7.10 | ||||||
|       hooks: |       hooks: | ||||||
|           - id: bandit |           - id: bandit | ||||||
|  |             args: [-c, pyproject.toml] | ||||||
|  |             additional_dependencies: ['bandit[toml]'] | ||||||
|     - repo: https://github.com/PyCQA/isort |     - repo: https://github.com/PyCQA/isort | ||||||
|       rev: 5.13.2 |       rev: 5.13.2 | ||||||
|       hooks: |       hooks: | ||||||
|  | @ -45,3 +47,11 @@ repos: | ||||||
|       hooks: |       hooks: | ||||||
|           - id: remove-crlf |           - id: remove-crlf | ||||||
|           - id: remove-tabs |           - id: remove-tabs | ||||||
|  |     - repo: local | ||||||
|  |       hooks: | ||||||
|  |           - id: pytest-check | ||||||
|  |             name: pytest-check | ||||||
|  |             entry: pytest | ||||||
|  |             language: system | ||||||
|  |             pass_filenames: false | ||||||
|  |             always_run: true | ||||||
|  |  | ||||||
|  | @ -16,3 +16,9 @@ source env/bin/activate | ||||||
| pip3 install ".[dev]" | pip3 install ".[dev]" | ||||||
| pre-commit install | pre-commit install | ||||||
| ``` | ``` | ||||||
|  | 
 | ||||||
|  | Run tests | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | pytest -svv | ||||||
|  | ``` | ||||||
|  |  | ||||||
|  | @ -13,4 +13,8 @@ description = "config generator for joj3" | ||||||
| readme = "README.md" | readme = "README.md" | ||||||
| 
 | 
 | ||||||
| [project.optional-dependencies] | [project.optional-dependencies] | ||||||
| dev = ["pre-commit>=3.7.1", "black>=24.4.2"] | dev = ["pre-commit>=3.7.1", "black>=24.4.2", "pytest>=8.3.3"] | ||||||
|  | 
 | ||||||
|  | [tool.bandit] | ||||||
|  | exclude_dirs = ["tests"] | ||||||
|  | skips = ["B101"] | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								tests/example_test.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								tests/example_test.py
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | ||||||
|  | # from xxx import generate | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | from typing import Any | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def test_generate() -> None: | ||||||
|  |     generate = lambda x: x  # TODO: real generate function imported | ||||||
|  |     data_input: dict[Any, Any] = {}  # TODO: load real input from some file | ||||||
|  |     data_output: dict[Any, Any] = generate(data_input) | ||||||
|  |     expected_output: dict[Any, Any] = {}  # TODO: load real output from some file | ||||||
|  |     assert data_output == expected_output | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user