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