summaryrefslogtreecommitdiffstats
path: root/server/tests/regression_test.py
blob: e53bf87811b2dfc2a550b9a9c2fe71a98ad21078 (plain)
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
#!/usr/bin/python
from subprocess import PIPE, Popen
import Image
import ImageChops


def snappy():
    cmd = "snappy -h localhost -p 5912 -o output.ppm"
    p = Popen(cmd, shell=True)
    p.wait()

def verify():
    base = Image.open("base_test.ppm")
    output = Image.open("output.ppm")
    return ImageChops.difference(base, output).getbbox()

if __name__ == "__main__":
    snappy()
    diff = verify()

    if diff is None:
        print("\033[1;32mSUCCESS: No regressions were found!\033[1;m")
    else:
        print("\033[1;31mFAIL: Regressions were found!\n\033[1;m"
              "\033[1;31m      Please, take a look in your code and go fix it!\033[1;m")