diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a6ec870 --- /dev/null +++ b/.gitignore @@ -0,0 +1,108 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Test artifacts +/tmp/test-output*/ +/tmp/test-projects/ +tests/__pycache__/ +tests/.pytest_cache/ diff --git a/Makefile b/Makefile index e24ba95..9705b26 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ test-gen: test-full: @echo "Running full test suite..." - $(PYTHON) run_tests.py + $(PYTHON) tests/run_tests.py test: test-basic test-gen test-full @echo "All tests completed!" diff --git a/README.md b/README.md index e790b70..ac9878e 100644 --- a/README.md +++ b/README.md @@ -94,10 +94,10 @@ make tox-all # Run all tox environments ```bash # Individual test scripts -python validate_template.py # Comprehensive validation -python quick_test.py # Quick validation -python run_tests.py # Full test suite -python -m pytest test_cookiecutter.py -v # Pytest tests +python validate_template.py # Comprehensive validation +python tests/quick_test.py # Quick validation +python tests/run_tests.py # Full test suite +python -m pytest tests/test_cookiecutter.py -v # Pytest tests ``` ### Available Tox Environments diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..1f3807d --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,6 @@ +""" +Tests for the Django OAuth2 Cookiecutter template. + +This package contains all test files for validating the cookiecutter template +structure, functionality, and generated project quality. +""" diff --git a/quick_test.py b/tests/quick_test.py similarity index 98% rename from quick_test.py rename to tests/quick_test.py index f35f695..da0af0c 100644 --- a/quick_test.py +++ b/tests/quick_test.py @@ -17,7 +17,7 @@ def main(): print("Django OAuth2 Cookiecutter Template - Quick Validation") print("=" * 60) - template_dir = os.path.dirname(os.path.abspath(__file__)) + template_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) errors = [] # Test 1: Check cookiecutter.json exists and is valid diff --git a/run_tests.py b/tests/run_tests.py similarity index 98% rename from run_tests.py rename to tests/run_tests.py index 5ee3fb5..9161694 100755 --- a/run_tests.py +++ b/tests/run_tests.py @@ -39,7 +39,7 @@ def run_basic_validation(): # Run the validation script result = subprocess.run([ python_exe, - os.path.join(os.path.dirname(__file__), "validate_template.py") + os.path.join(os.path.dirname(os.path.dirname(__file__)), "validate_template.py") ], capture_output=True, text=True) if result.returncode == 0: diff --git a/test_cookiecutter.py b/tests/test_cookiecutter.py similarity index 99% rename from test_cookiecutter.py rename to tests/test_cookiecutter.py index 5910751..b70993e 100644 --- a/test_cookiecutter.py +++ b/tests/test_cookiecutter.py @@ -29,7 +29,7 @@ def temp_dir(): @pytest.fixture def template_dir(): """Get the template directory path.""" - return os.path.dirname(os.path.abspath(__file__)) + return os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @pytest.fixture diff --git a/tox.ini b/tox.ini index 2744b8e..bdea6bf 100644 --- a/tox.ini +++ b/tox.ini @@ -7,7 +7,7 @@ skip_missing_interpreters = true deps = -r{toxinidir}/test-requirements.txt commands = - python -m pytest test_cookiecutter.py -v + python -m pytest tests/test_cookiecutter.py -v [testenv:validate] deps = @@ -19,13 +19,13 @@ commands = deps = -r{toxinidir}/test-requirements.txt commands = - python quick_test.py + python tests/quick_test.py [testenv:template-test] deps = -r{toxinidir}/test-requirements.txt commands = - python run_tests.py + python tests/run_tests.py [testenv:lint] deps = @@ -50,7 +50,7 @@ deps = -r{toxinidir}/test-requirements.txt coverage>=7.0.0 commands = - coverage run -m pytest test_cookiecutter.py + coverage run -m pytest tests/test_cookiecutter.py coverage report -m coverage html coverage xml @@ -60,8 +60,8 @@ deps = -r{toxinidir}/test-requirements.txt commands = python validate_template.py - python quick_test.py - python -m pytest test_cookiecutter.py -v + python tests/quick_test.py + python -m pytest tests/test_cookiecutter.py -v [flake8] max-line-length = 88