Mercurial > hg > GlobalNeighbors
annotate tests/test_console_scripts.py @ 24:40a9850076a4
[documentation] links
| author | Jeff Hammel <k0scist@gmail.com> | 
|---|---|
| date | Mon, 04 Sep 2017 14:54:38 -0700 | 
| parents | 5dba84370182 | 
| children | 
| rev | line source | 
|---|---|
| 0 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 1 #!/usr/bin/env python | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 2 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 3 """ | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 4 test console scripts | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 5 """ | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 6 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 7 import os | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 8 import subprocess | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 9 import unittest | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 10 from globalneighbors import main | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 11 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 12 here = os.path.dirname(os.path.abspath(__file__)) | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 13 data = os.path.join(here, 'data') | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 14 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 15 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 16 class TestConsoleScripts(unittest.TestCase): | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 17 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 18 # path to full data | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 19 full_tsv = os.path.join(data, 'cities1000.txt') | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 20 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 21 def test_main(self): | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 22 """test main API""" | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 23 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 24 assert os.path.exists(self.full_tsv) | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 25 main.main(args=[self.full_tsv]) | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 26 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 27 def test_subprocess(self): | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 28 """ | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 29 test invoking `global-neighbors` | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 30 as a subprocess | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 31 """ | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 32 # TODO | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 33 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 34 | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 35 if __name__ == '__main__': | 
| 
5dba84370182
initial commit; half-working prototype
 Jeff Hammel <k0scist@gmail.com> parents: diff
changeset | 36 unittest.main() | 
