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 ="""<script\s+.*?src\s*?=\s*?".*?qunit.js".*?>.*?</script>""", body)
+                if match:
+                    return os.path.relpath(path, root)
         return None
                    var payload = JSON.stringify(args);
                catch (e) {
-                   args = {return (e).toString();})
+                   args = {return String(e);})
                    payload = JSON.stringify(args);
             raise NotFound
         source = open(realpath).read()
-        match ="<.*?glueon.*?-->", source)
+        match ="<.*?glueon.*?-->", source)
         if match:
             source = source.replace(,
                        """<script src="/glueon/qunit/hooks.js"></script>""")
+        else:
+            match ="""<script\s+.*?src\s*?=\s*?".*?qunit.js".*?>.*?</script>""", source)
+            source = source.replace(,
+                           +  """\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:
             self.errors.append((self.current_test, result, message))
         # 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
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.