summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-01 17:32:51 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-03-01 17:32:51 -0600
commitf6c087cfe48e6410db61a9367ce7c718a490af77 (patch)
treea2130aa5b47c3dd17ab698db9374343915193579 /test
parentff89cb9c4de8240d7a7f79406755a86d8d2d5f18 (diff)
downloadfork-ledger-f6c087cfe48e6410db61a9367ce7c718a490af77.tar.gz
fork-ledger-f6c087cfe48e6410db61a9367ce7c718a490af77.tar.bz2
fork-ledger-f6c087cfe48e6410db61a9367ce7c718a490af77.zip
Added a new 'python' directive
Diffstat (limited to 'test')
-rwxr-xr-xtest/LedgerHarness.py4
-rwxr-xr-xtest/RegressTests.py4
-rw-r--r--test/baseline/dir-python_py.test26
-rw-r--r--test/baseline/feat-import_py.test23
-rw-r--r--test/baseline/featimport.py4
5 files changed, 60 insertions, 1 deletions
diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py
index c0dbe368..7b4dfa83 100755
--- a/test/LedgerHarness.py
+++ b/test/LedgerHarness.py
@@ -34,6 +34,7 @@ class LedgerHarness:
failed = 0
verify = False
gmalloc = False
+ python = False
def __init__(self, argv):
if not os.path.isfile(argv[1]):
@@ -49,6 +50,9 @@ class LedgerHarness:
self.failed = 0
self.verify = '--verify' in argv
self.gmalloc = '--gmalloc' in argv
+ self.python = '--python' in argv
+
+ os.chdir(self.sourcepath)
def run(self, command, verify=None, gmalloc=None, columns=True):
env = os.environ.copy()
diff --git a/test/RegressTests.py b/test/RegressTests.py
index 28a6c709..def202e4 100755
--- a/test/RegressTests.py
+++ b/test/RegressTests.py
@@ -179,7 +179,9 @@ if __name__ == '__main__':
if os.path.isdir(tests):
tests = [os.path.join(tests, x)
- for x in os.listdir(tests) if x.endswith('.test')]
+ for x in os.listdir(tests)
+ if (x.endswith('.test') and
+ (not '_py.test' in x or harness.python))]
if pool:
pool.map(do_test, tests, 1)
else:
diff --git a/test/baseline/dir-python_py.test b/test/baseline/dir-python_py.test
new file mode 100644
index 00000000..e4681075
--- /dev/null
+++ b/test/baseline/dir-python_py.test
@@ -0,0 +1,26 @@
+python
+ import os
+ def check_path(path_value):
+ return os.path.isfile(path_value)
+
+tag PATH
+ check check_path(value)
+
+2012-02-29 KFC
+ ; PATH: test/baseline/feat-import_py.test
+ Expenses:Food $20
+ Assets:Cash
+
+2012-02-29 KFC
+ ; PATH: test/baseline/feat-import_noexist.test
+ Expenses:Food $20
+ Assets:Cash
+
+test reg
+12-Feb-29 KFC Expenses:Food $20 $20
+ Assets:Cash $-20 0
+12-Feb-29 KFC Expenses:Food $20 $20
+ Assets:Cash $-20 0
+__ERROR__
+Warning: "$sourcepath/test/baseline/dir-python_py.test", line 17: Metadata check failed for (PATH: test/baseline/feat-import_noexist.test): check_path(value)
+end test
diff --git a/test/baseline/feat-import_py.test b/test/baseline/feat-import_py.test
new file mode 100644
index 00000000..6bd77586
--- /dev/null
+++ b/test/baseline/feat-import_py.test
@@ -0,0 +1,23 @@
+--import featimport.py
+
+tag PATH
+ check check_path(value)
+
+2012-02-29 KFC
+ ; PATH: test/baseline/feat-import_py.test
+ Expenses:Food $20
+ Assets:Cash
+
+2012-02-29 KFC
+ ; PATH: test/baseline/feat-import_noexist.test
+ Expenses:Food $20
+ Assets:Cash
+
+test reg
+12-Feb-29 KFC Expenses:Food $20 $20
+ Assets:Cash $-20 0
+12-Feb-29 KFC Expenses:Food $20 $20
+ Assets:Cash $-20 0
+__ERROR__
+Warning: "$sourcepath/test/baseline/feat-import_py.test", line 14: Metadata check failed for (PATH: test/baseline/feat-import_noexist.test): check_path(value)
+end test
diff --git a/test/baseline/featimport.py b/test/baseline/featimport.py
new file mode 100644
index 00000000..9edd9ba3
--- /dev/null
+++ b/test/baseline/featimport.py
@@ -0,0 +1,4 @@
+import os
+
+def check_path(path_value):
+ return os.path.isfile(str(path_value))