-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for newer_pairwise_group().
- Loading branch information
Daniel Nunes
committed
Jan 15, 2017
1 parent
59d325c
commit a40114a
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from setuptools.dep_util import newer_pairwise_group | ||
import os | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def groups_target(tmpdir): | ||
"""Sets up some older sources, a target and newer sources. | ||
Returns a 3-tuple in this order. | ||
""" | ||
creation_order = ['older.c', 'older.h', 'target.o', 'newer.c', 'newer.h'] | ||
mtime = 0 | ||
|
||
for i in range(len(creation_order)): | ||
creation_order[i] = os.path.join(str(tmpdir), creation_order[i]) | ||
with open(creation_order[i], 'w'): | ||
pass | ||
|
||
# make sure modification times are sequential | ||
os.utime(creation_order[i], (mtime, mtime)) | ||
mtime += 1 | ||
|
||
return creation_order[:2], creation_order[2], creation_order[3:] | ||
|
||
|
||
def test_newer_pairwise_group(groups_target): | ||
older = newer_pairwise_group([groups_target[0]], [groups_target[1]]) | ||
newer = newer_pairwise_group([groups_target[2]], [groups_target[1]]) | ||
assert older == ([], []) | ||
assert newer == ([groups_target[2]], [groups_target[1]]) |