I have a simple testing harness written in Python. Internally, it uses the Python unittest module.
When I hit cmd-r to run the testing scripting, pymate is eating the output from the test run *unless* I "print" at least a single newline prior to the TestCases' invocation.
Anyone seen this before? The workaround is trivial -- add a bare 'print' statement prior to passing control to the tests.
b.bum
Bill Bumgarner wrote:
I have a simple testing harness written in Python. Internally, it uses the Python unittest module.
When I hit cmd-r to run the testing scripting, pymate is eating the output from the test run *unless* I "print" at least a single newline prior to the TestCases' invocation.
Anyone seen this before? The workaround is trivial -- add a bare 'print' statement prior to passing control to the tests.
IMO, pymate could use some reworking. It would be nice to bring it up to using Soryu's nice css, and putting some hyperlinks in tracebacks to the lines with errors, etc. I am unfortunately not very interested in working on it any time in the near future (like the next couple of months at least), but it might be valuable to have a discussion on this list about the best way to architect a new pymate, and maybe a more general framework for these script runner commands, which are useful in many many languages.
-Jacob
On Nov 1, 2006, at 6:27 PM, Jacob Rus wrote:
IMO, pymate could use some reworking. It would be nice to bring it up to using Soryu's nice css, and putting some hyperlinks in tracebacks to the lines with errors, etc. I am unfortunately not very interested in working on it any time in the near future (like the next couple of months at least), but it might be valuable to have a discussion on this list about the best way to architect a new pymate, and maybe a more general framework for these script runner commands, which are useful in many many languages.
Agreed. There are three major features that I'd like to have right about now:
(1) be able to trigger pymate (scriptmate or whatever the new thing is called) to run a sort of "designated driver script" at the root level of a project directory. Specifically: I'm editing a unit test in my testsuite/ subdirectory and I want to hit a single command sequence to cause the run-tests.py script (found in the top level "project" directory -- top level directory resulting from a 'mate .' at the command line) to be executed.
(2) Be able to do (1) such that the path to the file I'm editing is passed as an argument to the sub command. Specifically: I want to be able to run the test I'm current editing.
(2a) Be able to select some random chunk of text and have it passed as arguments to the script from (1). This would let me type the name of a handful of the potentially dozens of tests I want to run and invoke them directly.
(3) Allow (1) to be executed even without a file being selected and displayed in the editor section of the window+drawer
I also see no particular reason why pymate should be python specific. One could easily imagine that the above mechanism, plus a couple of additional features, could be a generically useful way of dealing with a collection / hierarchy of files with a Top Level processing script of some kind.
Something like:
- bless a top level file as the "mate driver"
- once blessed, (1), (2), and (3) would all execute that driver script with the appropriate additional behavior.
- parse the output and hyperlink anything that falls into a standard sort of "refers to this file:line:" kind of format. gcc's output seems like the obvious starting point that most people use.
I don't have a surplus of time on my hands, either, but the above would greatly accelerate my work and, as such, I might dig up the time to work on it.
b.bum
On 2-nov-2006, at 6:32, Bill Bumgarner wrote:
[...] There are three major features that I'd like to have right about now:
(1) be able to trigger pymate (scriptmate or whatever the new thing is called) to run a sort of "designated driver script" at the root level of a project directory. Specifically: I'm editing a unit test in my testsuite/ subdirectory and I want to hit a single command sequence to cause the run-tests.py script (found in the top level "project" directory -- top level directory resulting from a 'mate .' at the command line) to be executed.
At least your first wish-feature can easily be done. I just finished a (global) command, "attached" to my project, which does something remotely connected.
It only runs if there is a special project variable saying so. It restarts Apache and after that's been successful, it loads (or refreshes) a "designated" test url.
It uses a project variable ($MY_SITE_TEST ) to check whether it actually should do it's thing. And then, if there is no project variable $MY_SITE_TEST_URL given, it runs TextMateTestUrl.py, which just outputs a url to test. I like to get that url from this python script, for this allows me to add extra clauses (when to test what) and lets me add comments to these test urls.
writing this script was fairly easy. The hardest part was to check on the stopping and starting of Apache.
I'm not sure if this helps any to the discussion, but I thought it was related, and I thought I share. Below is the complete script, if this is usefull for anybody
best dirk
if [[ "$MY_SITE_TEST" == 1 ]]; then if [[ "$MY_SITE_TEST_RESTART_APACHE" == 1 ]]; then # # For restarting apache we need to first stop it # and wait till all processes has been halted and # then restart it again. # We assume here that Apache has 4 (httpd) processes running # when fully functional and active # "${TM_BUNDLE_SUPPORT}/apachectlUsingKeychain.sh" stop for (( i = 0; i < 50 && $(echo $(ps -ax | grep [h]ttpd | wc -l))
0; i++ )); do
sleep .2; done if [ $(ps -ax | grep [h]ttpd | wc -l) == 0 ]; then echo Apache has stopped "${TM_BUNDLE_SUPPORT}/apachectlUsingKeychain.sh" start for (( i = 0; i < 50 && $(echo $(ps -ax | grep [h]ttpd | wc - l)) < 4; i++ )); do sleep .2; done if [ $(ps -ax | grep [h]ttpd | wc -l) == 4 ]; then echo Apache has started again else echo "$(date +%Y-%m-%d\ %H:%M:%S): Apache not yet fully running. Run test aborted." exit fi else echo "$(date +%Y-%m-%d\ %H:%M:%S): Apache is still running. Relaunch aborted." exit fi fi if [[ $MY_SITE_TEST_URL ]]; then echo From the Project Preferences T_URL=$MY_SITE_TEST_URL else echo From the TextMateTestUrl script TPY=${TM_PYTHON:-pythonw} T_URL=$(echo $("$TPY" "$TM_PROJECT_DIRECTORY/TextMateTestUrl.py")) fi osascript -e "tell app "Safari" to open location "$T_URL"" fi