makePythonTdd.ps1¶
Here is the
./makePythonTdd.ps1
script from how to make a python test driven development environment$PROJECT_NAME=$args[0] mkdir $PROJECT_NAME cd $PROJECT_NAME mkdir src New-Item "src/$PROJECT_NAME.py" mkdir tests New-Item tests/__init__.py "import unittest class Test$($PROJECT_NAME)(unittest.TestCase): def test_failure(self): self.assertFalse(True) # Exceptions Encountered # AssertionError " | Out-File "tests/test_$PROJECT_NAME.py" -Encoding UTF8 python -m venv .venv .venv/scripts/activate.ps1 python -m pip install --upgrade pip "pytest-watch" | Out-File requirements.txt -Encoding UTF8 python -m pip install --requirement requirements.txt pytest-watch
give a name for the
$PROJECT_NAME
variable when the program is called to make a Test Driven Development on demand. for example typing this command in the terminal in the folder wheremakePythonTdd.ps1
is saved will make a Test Driven Development environment for a project calledcalculator
./makePythonTdd.ps1 calculator