fixing DQ issues
This commit is contained in:
92
windows_migration_script.txt
Normal file
92
windows_migration_script.txt
Normal file
@@ -0,0 +1,92 @@
|
||||
@echo off
|
||||
REM migrate_tests.bat - Windows script to migrate your test structure
|
||||
|
||||
echo Starting test structure migration...
|
||||
|
||||
REM Create new directory structure
|
||||
echo Creating directory structure...
|
||||
mkdir tests\fixtures 2>nul
|
||||
mkdir tests\unit 2>nul
|
||||
mkdir tests\unit\models 2>nul
|
||||
mkdir tests\unit\utils 2>nul
|
||||
mkdir tests\unit\services 2>nul
|
||||
mkdir tests\integration 2>nul
|
||||
mkdir tests\integration\api 2>nul
|
||||
mkdir tests\integration\api\v1 2>nul
|
||||
mkdir tests\integration\security 2>nul
|
||||
mkdir tests\performance 2>nul
|
||||
mkdir tests\system 2>nul
|
||||
mkdir tests\test_data 2>nul
|
||||
mkdir tests\test_data\csv 2>nul
|
||||
|
||||
REM Create __init__.py files
|
||||
echo Creating __init__.py files...
|
||||
echo. > tests\fixtures\__init__.py
|
||||
echo. > tests\unit\__init__.py
|
||||
echo. > tests\unit\models\__init__.py
|
||||
echo. > tests\unit\utils\__init__.py
|
||||
echo. > tests\unit\services\__init__.py
|
||||
echo. > tests\integration\__init__.py
|
||||
echo. > tests\integration\api\__init__.py
|
||||
echo. > tests\integration\api\v1\__init__.py
|
||||
echo. > tests\integration\security\__init__.py
|
||||
echo. > tests\performance\__init__.py
|
||||
echo. > tests\system\__init__.py
|
||||
|
||||
REM Create conftest.py files for each test category
|
||||
echo Creating conftest.py files...
|
||||
echo. > tests\unit\conftest.py
|
||||
echo. > tests\integration\conftest.py
|
||||
echo. > tests\performance\conftest.py
|
||||
echo. > tests\system\conftest.py
|
||||
|
||||
REM Backup original files
|
||||
echo Backing up original files...
|
||||
mkdir tests\backup 2>nul
|
||||
copy tests\conftest.py tests\backup\ >nul 2>&1
|
||||
copy tests\test_*.py tests\backup\ >nul 2>&1
|
||||
|
||||
echo Directory structure created!
|
||||
echo.
|
||||
echo Next steps:
|
||||
echo 1. Copy the fixture files I provided to tests\fixtures\
|
||||
echo 2. Update tests\conftest.py with the new version
|
||||
echo 3. Move test files to their new locations:
|
||||
echo - test_database.py to tests\unit\models\test_database_models.py
|
||||
echo - test_utils.py to tests\unit\utils\test_data_processing.py
|
||||
echo - test_admin_service.py to tests\unit\services\
|
||||
echo - test_admin.py to tests\integration\api\v1\test_admin_endpoints.py
|
||||
echo - test_pagination.py to tests\integration\api\v1\
|
||||
echo - test_performance.py to tests\performance\test_api_performance.py
|
||||
echo - test_error_handling.py to tests\system\
|
||||
echo - Split test_security.py into security subdirectory
|
||||
echo.
|
||||
echo 4. Update imports in moved test files
|
||||
echo 5. Add pytest markers to test classes
|
||||
echo 6. Update pytest.ini with the enhanced configuration
|
||||
echo.
|
||||
echo Test the migration with:
|
||||
echo pytest tests\unit -v
|
||||
echo pytest tests\integration -v
|
||||
echo pytest -m unit
|
||||
echo.
|
||||
echo Quick test commands after migration:
|
||||
echo pytest -m unit # Fast unit tests
|
||||
echo pytest -m integration # Integration tests
|
||||
echo pytest -m "not slow" # Skip slow tests
|
||||
echo pytest tests\unit\models\ # Model tests only
|
||||
echo pytest --cov=app --cov-report=html # Coverage report
|
||||
|
||||
REM Create a sample test data file
|
||||
echo Creating sample test data...
|
||||
(
|
||||
echo product_id,title,price,currency,brand,marketplace
|
||||
echo TEST001,Sample Product 1,19.99,EUR,TestBrand,TestMarket
|
||||
echo TEST002,Sample Product 2,29.99,EUR,TestBrand,TestMarket
|
||||
echo TEST003,Sample Product 3,39.99,USD,AnotherBrand,TestMarket
|
||||
) > tests\test_data\csv\sample_products.csv
|
||||
|
||||
echo.
|
||||
echo Migration structure ready! Follow the steps above to complete the migration.
|
||||
echo All your original files are backed up in tests\backup\
|
||||
pause
|
||||
Reference in New Issue
Block a user