Rune Halvorsen avatar Rune Halvorsen committed 6591b08

Added autodetection of test runners without special glueon tag

Comments (0)

Files changed (1)

                 if match:
                     return os.path.relpath(path, root)
 
+                # fixme: check for option about autodetection.
+                match = re.search(r"""<script\s+.*?src\s*?=\s*?".*?qunit.js".*?>.*?</script>""", body)
+                if match:
+                    return os.path.relpath(path, root)
+
         return None
 
     @property
                    var payload = JSON.stringify(args);
                }
                catch (e) {
-                   args = args.map(function(e) {return (e).toString();})
+                   args = args.map(function(e) {return String(e);})
                    payload = JSON.stringify(args);
                }
                conn.send(payload);
             raise NotFound
 
         source = open(realpath).read()
-        match =  re.search(r"<.*?glueon.*?-->", source)
+        match = re.search(r"<.*?glueon.*?-->", source)
         if match:
             source = source.replace(match.group(0),
                        """<script src="/glueon/qunit/hooks.js"></script>""")
+        else:
+            match = re.search(r"""<script\s+.*?src\s*?=\s*?".*?qunit.js".*?>.*?</script>""", source)
+            source = source.replace(match.group(0),
+                                    match.group(0) +  """\n<script src="/glueon/qunit/hooks.js"></script>""")
 
         response = Response(source)
         response.headers['content-type'] = "text/html"
         self.logcnt = 1
 
     def log(self, result, message):
-        if message == "failed":
+        if not result:
             sys.stdout.write("F")
             self.errors.append((self.current_test, result, message))
         else:
         # keyboardinterrupt on its own. We want to do so ourselves.
         httpd = make_server('', options.port, app, handler_class=SilentWSGIRequestHandler)
         httpd.timeout = 0.5
-        print >> sys.stderr, "Serving"
 
         if options.launch:
             browser = webbrowser.get(options.browser)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.