]> git.phdru.name Git - ppu.git/blob - tests/test_cmp.py
Tests: Remove unused tmp_dir
[ppu.git] / tests / test_cmp.py
1 #! /usr/bin/env python
2
3 import os
4 import subprocess
5 import sys
6 from ppu_tu import setup, teardown, find_in_path  # noqa
7
8
9 test_prog_path = find_in_path('cmp.py')
10 if not test_prog_path:
11     sys.exit("Cannot find cmp.py in %s" % os.environ["PATH"])
12
13
14 def create_file(name, content):
15     with open(name, 'w') as fp:
16         fp.write(content)
17
18
19 def test_cmp_equal():
20     create_file('test1', 'test')
21     create_file('test2', 'test')
22     assert subprocess.call(
23         [sys.executable, test_prog_path, "-i", "test1", "test2"]) == 0
24
25     create_file('test3', 'test3')
26     create_file('test4', 'test4')
27     assert subprocess.call(
28         [sys.executable, test_prog_path, "-i", "test3", "test4"]) == 1