jenkins-bot has submitted this change and it was merged. Change subject: Appveyor CI Win32 builds ......................................................................
Appveyor CI Win32 builds Allow tests relying on pywinauto to be skipped if pywinauto is missing or non-functional, as pywin32 installation has not been added to the Appveyor build script. Change-Id: Ifc82582ee2044f1753d0f2c7b9aff4c0f901f259 --- A .appveyor.yml M setup.py M tests/README.rst M tests/ui_tests.py 4 files changed, 91 insertions(+), 8 deletions(-) Approvals: John Vandenberg: Looks good to me, but someone else must approve XZise: Looks good to me, approved jenkins-bot: Verified diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..c91b550 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,50 @@ +environment: + + global: + # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the + # /E:ON and /V:ON options are not enabled in the batch script intepreter + # See: http://stackoverflow.com/a/13751649/163740 + WITH_COMPILER: "cmd /E:ON /V:ON /C run_with_compiler.cmd" + PYWIKIBOT2_DIR: "%appdata%\\Pywikibot" + + matrix: + - PYTHON: "C:\\Python27" + PYTHON_VERSION: "2.7.8" + PYTHON_ARCH: "32" + + - PYTHON: "C:\\Python33" + PYTHON_VERSION: "3.3.5" + PYTHON_ARCH: "32" + + - PYTHON: "C:\\Python34" + PYTHON_VERSION: "3.4.1" + PYTHON_ARCH: "32" + +init: + - "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%" + +install: + - git submodule update --init + - ps: (new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/pypa/python-packaging-user-guide/master/source/code/install.ps1', 'install.ps1') + - "powershell install.ps1" + - ps: (new-object net.webclient).DownloadFile('https://raw.githubusercontent.com/pypa/python-packaging-user-guide/master/source/code/run_with_compiler.cmd', 'run_with_compiler.cmd') + - cd externals/httplib2 + - "%WITH_COMPILER% %PYTHON%\\python setup.py install" + - cd ..\\.. + +build: off + +test_script: + - chcp 65001 + - mkdir "%PYWIKIBOT2_DIR%" + - echo mylang = 'en' > "%PYWIKIBOT2_DIR%\\user-config.py" + - echo family = 'wikipedia' >> "%PYWIKIBOT2_DIR%\\user-config.py" + - echo max_retries = 2 >> "%PYWIKIBOT2_DIR%\\user-config.py" + - echo maximum_GET_length = 5000 >> "%PYWIKIBOT2_DIR%\\user-config.py" + - echo console_encoding = 'utf8' >> "%PYWIKIBOT2_DIR%\\user-config.py" + - echo transliteration_target = None >> "%PYWIKIBOT2_DIR%\\user-config.py" + + - "%WITH_COMPILER% %PYTHON%\\python setup.py test" + +artifacts: + - path: dist\* diff --git a/setup.py b/setup.py index b36244a..a33928e 100644 --- a/setup.py +++ b/setup.py @@ -91,10 +91,12 @@ # when trying to build the C modules. dependencies += extra_deps['mwparserfromhell'] +# setup can't detect or install pywin32, which pywinauto depends on. +# appveyor builds do not install pywin32 if os.name == 'nt': # FIXME: tests/ui_tests.py suggests pywinauto 0.4.2 # which isnt provided on pypi. - test_deps += ['pywin32>=218', 'pywinauto>=0.4.0'] + test_deps += ['pywinauto>=0.4.0'] extra_deps.update(script_deps) diff --git a/tests/README.rst b/tests/README.rst index 214c110..3080680 100644 --- a/tests/README.rst +++ b/tests/README.rst @@ -71,7 +71,7 @@ python pwb.py tests/site_tests.py -v -travis-ci +Travis CI ========= After changes are published into a github repository, tests may be run on @@ -114,6 +114,26 @@ It is strongly recommended that an untrusted bot account is created for travis tests, using a password that is not shared with trusted accounts. +Appveyor CI +=========== + +After changes are published into a github repository, tests may be run on +a Microsoft Windows box provided by ci.appveyor.com according to the +configuration in .appveyor.yml . To do this: + +1. create a github and appveyor account +2. fork the main github repository +3. create a project in ci.appveyor.com +4. go to https://ci.appveyor.com/project/<username>/pywikibot-core/settings + and enter the custom configuration .yml filename: .appveyor.yml +4. push changes into the forked git repository +5. watch the build at https://ci.appveyor.com/<username>/pywikibot-core/history + +The 'user' tests are not yet enabled on appveyor builds. + +Environment variables +===================== + There are a set of 'edit failure' tests, which attempt to write to the wikis and **should** fail. If there is a bug in pywikibot or MediaWiki, these tests **may** actually perform a write operation. @@ -121,16 +141,16 @@ These 'edit failure' tests are disabled by default for the 'wikimedia' builds, but are enabled by default on builds by any other github account. -To disable 'edit failure' tests in travis, add PYWIKIBOT2_TEST_WRITE_FAIL=0 +To disable 'edit failure' tests, set PYWIKIBOT2_TEST_WRITE_FAIL=0 There are also several other 'write' tests which also attempt to perform write operations successfully. These **will** write to the wikis, and they should always only write to 'test' wikis. -These 'write' tests are disabled in travis builds, and currently can not be -run on travis as they require interaction using a terminal. +These 'write' tests are disabled by default, and currently can not be +run on travis or appveyor as they require interaction using a terminal. -To enable 'write' tests in travis, add PYWIKIBOT2_TEST_WRITE=1 +To enable 'write' tests, set PYWIKIBOT2_TEST_WRITE=1 Contributing tests ================== diff --git a/tests/ui_tests.py b/tests/ui_tests.py index eea9256..73a86e4 100644 --- a/tests/ui_tests.py +++ b/tests/ui_tests.py @@ -34,6 +34,11 @@ import time import io +try: + import pywinauto +except ImportError: + pywinauto = None + import pywikibot from pywikibot.bot import ( ui, DEBUG, VERBOSE, INFO, STDOUT, INPUT, WARNING, ERROR, CRITICAL @@ -488,11 +493,12 @@ def setUpClass(cls): if os.name != 'nt': raise unittest.SkipTest('requires Windows console') + if not pywinauto: + raise unittest.SkipTest('requires Windows package pywinauto') super(WindowsTerminalTestCase, cls).setUpClass() @classmethod def setUpProcess(cls, command): - import pywinauto import subprocess si = subprocess.STARTUPINFO() si.dwFlags = subprocess.STARTF_USESTDHANDLES @@ -503,7 +509,12 @@ cls._app.connect_(process=cls._process.pid) # set truetype font (Lucida Console, hopefully) - cls._app.window_().TypeKeys('% {UP}{ENTER}^L{HOME}L{ENTER}', with_spaces=True) + try: + cls._app.window_().TypeKeys('% {UP}{ENTER}^L{HOME}L{ENTER}', with_spaces=True) + except: + # occurs if pywinauto is installed without pywin32. + raise unittest.SkipTest('Windows package pywinauto not functional; ' + 'maybe pywin32 isnt installed') @classmethod def tearDownProcess(cls): -- To view, visit https://gerrit.wikimedia.org/r/203643 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifc82582ee2044f1753d0f2c7b9aff4c0f901f259 Gerrit-PatchSet: 16 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: John Vandenberg <jay...@gmail.com> Gerrit-Reviewer: John Vandenberg <jay...@gmail.com> Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com> Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl> Gerrit-Reviewer: XZise <commodorefabia...@gmx.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits