Skip to content

Commit bf84879

Browse files
authored
Patch/appveyor tests (#22)
* improved appveyor functionality. * renamed win_get template
1 parent ac75731 commit bf84879

9 files changed

+33
-25
lines changed
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% extends "base.ahk" %}
22
{% block body %}
33
WinSet, {{subcommand}}, {{value}}, {{win.title}}, {{win.text}}, {{win._exclude_title}}, win._exclude_text}}
4-
{% endblock body %}
4+
{% endblock body %}

ahk/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
def make_logger(name):
55
logger = logging.getLogger(name)
6-
handler = logging.StreamHandler()
6+
handler = logging.NullHandler()
77
formatter = logging.Formatter(
88
'%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
99
handler.setFormatter(formatter)

ahk/window.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ def from_ahk_id(cls, engine, ahk_id):
2525
raise NotImplemented
2626

2727
def _win_set(self, subcommand, value):
28-
script = self.engine.render_template(win=self, subcommand=subcommand, value=value)
28+
script = self.engine.render_template('window/win_set.ahk', win=self, subcommand=subcommand, value=value)
2929
return script
3030

3131
def win_set(self, *args, **kwargs):
3232
script = self._win_set(*args, **kwargs)
3333
self.engine.run_script(script)
3434

3535
def _position(self):
36-
return self.engine.render_template('window/position.ahk', win=self)
36+
return self.engine.render_template('window/win_position.ahk', win=self)
3737

3838
def _get_pos(self):
3939
resp = self.engine.run_script(self._position())

appveyor.yml

+11-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ environment:
55
AHK_DEBUG: true
66

77
install:
8-
- appveyor DownloadFile https://github.com/Lexikos/AutoHotkey_L/releases/download/v1.1.30.01/AutoHotkey_1.1.30.01_setup.exe -FileName ahk_install.exe
8+
- ps: |
9+
if (!(Test-Path ahk_install.exe)) {
10+
echo "Downloading AHK installer"
11+
appveyor DownloadFile https://github.com/Lexikos/AutoHotkey_L/releases/download/v1.1.30.01/AutoHotkey_1.1.30.01_setup.exe -FileName ahk_install.exe
12+
} else {
13+
echo "Using cached installer"
14+
}
915
- ahk_install.exe /S /D=C:\ahk
1016
- cmd: .\ci\install.bat
1117

@@ -17,20 +23,15 @@ artifacts:
1723
path: dist\*
1824

1925
test_script:
20-
- cmd: .\ci\runtests.bat
21-
- ps: |
22-
$wc = New-Object 'System.Net.WebClient';
23-
Get-ChildItem .\reports |
24-
Foreach-Object {
25-
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $_.FullName))
26-
}
27-
26+
- powershell .\ci\runtests.ps1
2827

29-
on_success:
28+
on_finish:
3029
- cmd: |
3130
venv\Scripts\activate.bat
3231
python -m coveralls
3332
33+
cache:
34+
- ahk_install.exe -> appveyor.yml
3435

3536
deploy_script:
3637
- ps: |

ci/build.ps1

-3
This file was deleted.

ci/install.ps1

-4
This file was deleted.

ci/runtests.bat

-4
This file was deleted.

ci/runtests.ps1

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.\venv\Scripts\activate.ps1
2+
coverage run -m behave .\tests\features --format=progress2 --junit
3+
if ($LastExitCode -ne 0) {
4+
$failure = 1
5+
} else {
6+
$failure = 0
7+
}
8+
coverage run -a -m pytest .\tests\unittests --junitxml=reports\pytestresults.xml
9+
if ($LastExitCode -ne 0) {
10+
$failure = 1
11+
}
12+
$wc = New-Object 'System.Net.WebClient';
13+
Get-ChildItem .\reports |
14+
Foreach-Object {
15+
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $_.FullName))
16+
}
17+
if ($failure -ne 0) { throw }
18+
deactivate

0 commit comments

Comments
 (0)