Skip to content

Commit

Permalink
Added internal scripts for automated test in virtual environments wit…
Browse files Browse the repository at this point in the history
…h both PyQt5 and PySide2
  • Loading branch information
PierreRaybaut committed Aug 29, 2020
1 parent 7e7eb0e commit 534024e
Show file tree
Hide file tree
Showing 14 changed files with 98 additions and 85 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
- Added command-line options to the `PythonQwt-tests-py3` script to run all the tests
simultenously in unattended mode (`--mode unattended`) or to update all the
screenshots (`--mode screenshots`).
- Added internal scripts for automated test in virtual environments with both PyQt5 and
PySide2.

### Version 0.8.1 ###

Expand Down
23 changes: 0 additions & 23 deletions build_dist.bat

This file was deleted.

25 changes: 0 additions & 25 deletions build_doc.bat

This file was deleted.

13 changes: 0 additions & 13 deletions run_test_launcher.bat

This file was deleted.

5 changes: 3 additions & 2 deletions build_and_upload.bat → scripts/build_and_upload.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off
set UNATTENDED=1
call build_doc.bat
call build_dist.bat
call %~dp0build_doc.bat
call %~dp0build_dist.bat
@echo:
@echo ==============================================================================
choice /t 5 /c yn /cs /d n /m "Do you want to upload packages to PyPI (y/n)?"
Expand All @@ -10,6 +10,7 @@ if errorlevel 1 goto :yes
:yes
@echo ==============================================================================
@echo:
cd %~dp0..
twine upload dist/*
GOTO :continue
:no
Expand Down
10 changes: 10 additions & 0 deletions scripts/build_dist.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@echo off
cd %~dp0..\
if exist MANIFEST ( del /q MANIFEST )
if exist build ( rmdir /s /q build )
if exist dist ( rmdir /s /q dist )
call %~dp0func SetPythonPath
call %~dp0func UseWinPython
python setup.py sdist bdist_wheel --universal
python setup.py build sdist
call %~dp0func EndOfScript
12 changes: 12 additions & 0 deletions scripts/build_doc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@echo off
call %~dp0func SetPythonPath
call %~dp0func UseWinPython
set PATH=C:\Program Files\7-Zip;C:\Program Files (x86)\7-Zip;C:\Program Files\HTML Help Workshop;C:\Program Files (x86)\HTML Help Workshop;%PATH%
cd %~dp0..\
sphinx-build -b htmlhelp doc build\doc
hhc build\doc\PythonQwt.hhp
copy /y build\doc\PythonQwt.chm doc\_downloads
7z a doc\_downloads\PythonQwt.chm.zip doc\_downloads\PythonQwt.chm
move /y doc\PythonQwt.chm .
sphinx-build -b html doc build\doc
call %~dp0func EndOfScript
34 changes: 34 additions & 0 deletions scripts/func.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
REM Utilities for deployment, test and build scripts
@echo off
call:%*
goto Exit

:SetPythonPath
set PYTHONPATH=%~dp0..
goto:eof

:UseWinPython
if defined WINPYDIRBASE (
call %WINPYDIRBASE%\scripts\env.bat
call :ShowTitle "Using WinPython from %WINPYDIRBASE%"
)
goto:eof

:ShowTitle
@echo:
@echo ========= %~1 =========
@echo:
goto:eof

:EndOfScript
@echo:
@echo **********************************************************************************
@echo:
if not defined UNATTENDED (
@echo End of script
pause
)
goto:eof

:Exit
exit /b
6 changes: 6 additions & 0 deletions scripts/run_test_launcher.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
setlocal
call %~dp0func SetPythonPath
call %~dp0func UseWinPython
python -m qwt.tests.__init__
call %~dp0func EndOfScript
22 changes: 22 additions & 0 deletions scripts/run_test_venv.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@echo off
setlocal
set UNATTENDED=1
call %~dp0build_dist
set PYTHONPATH=
call %~dp0func UseWinPython
call :TestEnv PyQt5
call :TestEnv PySide2
set UNATTENDED=
call %~dp0func EndOfScript
exit /B %ERRORLEVEL%

:TestEnv
call %~dp0func ShowTitle "Testing in %~1-based Python virtual environment"
set VENVPATH=cd %~dp0..\build\testenv
python -m venv %VENVPATH%
call %VENVPATH%\Scripts\activate
pip install %~1
for %%f IN ("%~dp0..\dist\PythonQwt-*.whl") DO ( pip install %%f )
call %VENVPATH%\Scripts\PythonQwt-tests-py3 --mode unattended
call %VENVPATH%\Scripts\deactivate
exit /B 0
6 changes: 2 additions & 4 deletions run_unattended_tests.bat → scripts/run_unattended_tests.bat
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
@echo off

setlocal
set PYTHONPATH=%cd%
call %~dp0func SetPythonPath
cd %~dp0..\

if not defined WINPYDIRBASE ( goto :no )

choice /t 5 /c yn /cs /d n /m "Do you want to run tests only from %WINPYDIRBASE% (y/n)?"
if errorlevel 2 goto :no

:yes
call %WINPYDIRBASE%\scripts\env.bat
python qwt/tests/__init__.py --mode unattended
Expand Down
7 changes: 7 additions & 0 deletions scripts/take_screenshots.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
setlocal
call %~dp0func SetPythonPath
call %~dp0func UseWinPython
cd %~dp0..\
python qwt/tests/__init__.py --mode screenshots
call %~dp0func EndOfScript
13 changes: 0 additions & 13 deletions take_screenshots.bat

This file was deleted.

5 changes: 0 additions & 5 deletions upload.bat

This file was deleted.

0 comments on commit 534024e

Please sign in to comment.