@@ -9,8 +9,8 @@ distribution, including the tests of all the samples. These scripts
9
9
demonstrate the samples, as well as testing PyModel itself.
10
10
11
11
These notes describe our unit tests, along with our little homemade
12
- unit testing commands: trun, tdiff, and tclean. These commands are
13
- independent of the rest of PyModel (they could be used to test any
12
+ unit testing commands: tpath, trun, tdiff, and tclean. These commands
13
+ are independent of the rest of PyModel (they could be used to test any
14
14
program that writes to stdout). We use these (instead of a
15
15
conventional unit test framework like unittest or nose) because:
16
16
@@ -24,25 +24,34 @@ conventional unit test framework like unittest or nose) because:
24
24
The last section (below) explains how to script tests similar to ours
25
25
using the unittest module from the Python standard library.
26
26
27
- These directions apply to both Windows and Unix-like systems
28
- (including Linux and Mac OS X). The directions assume that Python is
29
- already installed and your environment is configured so you can run it
30
- (if not, see http://docs.python.org/2/using/). It also assumes that
31
- PyModel is present on your system, the contents of its PyModel/pymodel
32
- directory are on your Python path, the current directory is on your
33
- Pyton path, and the contents of its PyModel/bin directory are on your
34
- execution path. You can achieve this by executing
35
- PyModel/bin/pymodel_paths, or the commands therein.
36
-
37
- Quick Start
38
- Summary
27
+ Prerequisites
28
+ Running tests
29
+ Command summary
39
30
Commands and modules
40
31
Test scripts
41
32
Checking test script output
42
33
Output files
43
34
Using other unit testing frameworks
44
35
45
- Quick Start
36
+
37
+ Prerequisites
38
+
39
+ These directions apply to both Windows and Unix-like systems
40
+ (including Linux and Mac OS X). The directions assume that Python is
41
+ already installed and your environment is configured so you can run it
42
+ (if not, see http://docs.python.org/2/using/). It also assumes that
43
+ the upacked PyModel directories are present on your system, the
44
+ contents of its PyModel/pymodel directory are on your Python path, the
45
+ contents of its PyModel/bin directory are on your execution path, and
46
+ your current directory is on your Python path. You can achieve this
47
+ by executing PyModel/bin/pymodel_paths, or the commands therein.
48
+ Alternatively, you can install the contents of PyModel/pymodel and
49
+ PyModel/bin into system directories (see INSTALL.txt) but then you may
50
+ need to execute the command "source tpath" in each session (terminal
51
+ window) before you execute any PyModel commands.
52
+
53
+
54
+ Running tests
46
55
47
56
In each subdirectory of samples, type:
48
57
@@ -59,11 +68,13 @@ script is not deterministic and the tdiff command is not meaningful
59
68
-- instead just run trun test (or whatever).
60
69
61
70
62
- Summary
71
+ Command Summary
63
72
64
73
commands in bin directory
65
- trun - execute test script module
66
- tdiff - execute test script, compare output to reference
74
+ tpath - put current directory on PYTHONPATH, needed by trun
75
+ tpath.bat - ditto, batch script for Windows
76
+ trun - execute test script module named in argument
77
+ tdiff - execute command (usually trun ...), compare output to reference
67
78
tdiff.bat - ditto, batch script for Windows
68
79
tclean - remove output files created by running test scripts
69
80
tclean.bat - ditto, batch script for Windows
@@ -76,6 +87,7 @@ Programs and scripts in the pymodel directory
76
87
trun.py - executes test script module given as argument
77
88
78
89
In each model directory: samples/PowerSwitch, samples/WebApplication/Model,...
90
+
79
91
test.py - test script module, executed by trun
80
92
test.log - most recent output from test.py, including stdout and stderr,
81
93
saved by tdiff
@@ -89,6 +101,7 @@ In each model directory: samples/PowerSwitch, samples/WebApplication/Model,...
89
101
dot scripts (maybe via pmv.py), moved here by hand
90
102
pdf/ - ditto, .pdf (not many of these), moved here by hand
91
103
104
+
92
105
Programs, Modules, and Commands
93
106
94
107
In these notes, "the foo module" or "the foo program" means the Python
@@ -222,6 +235,7 @@ If a test case crashes (raises an unhandled exception) on Windows, the
222
235
traceback goes to the screen, not the log file. I can't find anything
223
236
in Windows like Unix >& to redirect error output also.
224
237
238
+
225
239
Output files
226
240
227
241
The PyModel pmt command only writes to the terminal (to stdout and
0 commit comments