1 |
alunduil 15/05/02 15:18:04 |
2 |
|
3 |
Added: fix-tests.patch |
4 |
Log: |
5 |
add version 2.3.2 |
6 |
|
7 |
(Portage version: 2.2.18/cvs/Linux x86_64, signed Manifest commit with key 11A8217C!) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-python/livereload/files/fix-tests.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/livereload/files/fix-tests.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/livereload/files/fix-tests.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: fix-tests.patch |
16 |
=================================================================== |
17 |
diff --git a/tests/test_watcher.py b/tests/test_watcher.py |
18 |
index fa0ae41..5310bdc 100644 |
19 |
--- a/tests/test_watcher.py |
20 |
+++ b/tests/test_watcher.py |
21 |
@@ -3,18 +3,22 @@ |
22 |
import os |
23 |
import time |
24 |
import shutil |
25 |
+import unittest |
26 |
from livereload.watcher import Watcher |
27 |
|
28 |
tmpdir = os.path.join(os.path.dirname(__file__), 'tmp') |
29 |
|
30 |
|
31 |
-class TestWatcher(object): |
32 |
+class TestWatcher(unittest.TestCase): |
33 |
|
34 |
def setUp(self): |
35 |
if os.path.isdir(tmpdir): |
36 |
shutil.rmtree(tmpdir) |
37 |
os.mkdir(tmpdir) |
38 |
|
39 |
+ def tearDown(self): |
40 |
+ shutil.rmtree(tmpdir) |
41 |
+ |
42 |
def test_watch_dir(self): |
43 |
os.mkdir(os.path.join(tmpdir, '.git')) |
44 |
os.mkdir(os.path.join(tmpdir, '.hg')) |
45 |
@@ -25,6 +29,9 @@ class TestWatcher(object): |
46 |
watcher.watch(tmpdir) |
47 |
assert watcher.is_changed(tmpdir) is False |
48 |
|
49 |
+ # sleep 1 second so that mtime will be different |
50 |
+ time.sleep(1) |
51 |
+ |
52 |
with open(os.path.join(tmpdir, 'foo'), 'w') as f: |
53 |
f.write('') |
54 |
|
55 |
@@ -35,6 +42,9 @@ class TestWatcher(object): |
56 |
watcher = Watcher() |
57 |
watcher.count = 0 |
58 |
|
59 |
+ # sleep 1 second so that mtime will be different |
60 |
+ time.sleep(1) |
61 |
+ |
62 |
filepath = os.path.join(tmpdir, 'foo') |
63 |
with open(filepath, 'w') as f: |
64 |
f.write('') |
65 |
@@ -51,22 +61,24 @@ class TestWatcher(object): |
66 |
with open(filepath, 'w') as f: |
67 |
f.write('') |
68 |
|
69 |
- assert watcher.examine() == os.path.abspath(filepath) |
70 |
+ rv = watcher.examine() |
71 |
+ assert rv[0] == os.path.abspath(filepath) |
72 |
assert watcher.count == 1 |
73 |
|
74 |
def test_watch_glob(self): |
75 |
watcher = Watcher() |
76 |
watcher.watch(tmpdir + '/*') |
77 |
- assert watcher.examine() is None |
78 |
+ assert watcher.examine() == (None, None) |
79 |
|
80 |
with open(os.path.join(tmpdir, 'foo.pyc'), 'w') as f: |
81 |
f.write('') |
82 |
|
83 |
- assert watcher.examine() is None |
84 |
+ assert watcher.examine() == (None, None) |
85 |
|
86 |
filepath = os.path.join(tmpdir, 'foo') |
87 |
|
88 |
with open(filepath, 'w') as f: |
89 |
f.write('') |
90 |
|
91 |
- assert watcher.examine() == os.path.abspath(filepath) |
92 |
+ rv = watcher.examine() |
93 |
+ assert rv[0] == os.path.abspath(filepath) |