~the-test-people/selenium-simple-test/internal

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Continuous Integration script for SST on Windows
#
#  Instructions:
#   1. ensure you have  Firefox or other supported browser installed
#   2. $ bzr branch lp:selenium-simple-test
#   3. cd selenium-simple-test
#   4. run this script
#

Param(
  [string] $Bootstrap,
  [switch] $Flake8,
  [string] $Acceptance
)

Write-Host "Cleaning Up..."
Remove-Item results,*.log,*.xml -Recurse -ErrorAction SilentlyContinue

if ($Bootstrap) {
    Remove-Item ENV -Recurse -ErrorAction SilentlyContinue
    Write-Host "Getting Dependencies..."
    if (Test-Path sst-deps) {
	cd sst-deps
	bzr pull
	cd ..
    } else {
	bzr branch 'lp:~ubuntuone-hackers/selenium-simple-test/sst-deps'
        # This is only necessary because I was a muppet when creating
        # my repo and passed --no-trees
	cd sst-deps
        bzr checkout
        cd ..
    }

    Write-Host "Creating virtualenv"
    virtualenv ENV -p $Bootstrap --quiet

    Write-Host "Activating virtualenv"
    . '.\ENV\Scripts\activate.ps1'

    Write-Host "Installing modules from dependencies branch..."
    $files = (Get-ChildItem '.\sst-deps\pythonpackages\*.tar.gz')
    $files | % { $_.Name } | Write-Host
    $files | foreach { pip install $_ --no-deps }

    pip install jinja2
} else {
    Write-Host "Activating virtualenv"
    . '.\ENV\Scripts\activate.ps1'
}

Write-Host "----------------------------------"
Write-Host "environment info:"
python -V
python -c "import django; print 'Django %s' % django.get_version()"
python -c "import selenium; print 'Selenium %s' % selenium.__version__"
python .\sst-run -V


if ($Flake8) {
    Write-Host "----------------------------------"
    Write-Host "running flake8 (pyflakes/pep8) checks..."
    $flake8args = @('src', 'docs')
    $flake8args += (Get-Childitem sst-*,*.py)
    & flake8 $flake8args
}

if ($Acceptance) {
    Write-Host "----------------------------------"
    Write-Host "running unit and acceptance tests..."
    python './sst-test' -s -r xml -b "$Acceptance" --extended-tracebacks
}