JavaScriptTestCase.testJavaScriptCode()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
from django.test import TestCase
2
import subprocess
3
import unittest
4
5
6
def mocha_exists():
7
    try:
8
        subprocess.call(["mocha-phantomjs", "-V"])
9
        return True
10
    except OSError:
11
        return False
12
13
14
class JavaScriptTestCase(TestCase):
15
16
    """
17
        Call JavaScript test framework to do the job.
18
    """
19
    @unittest.skipUnless(mocha_exists(), "requires mocha-phantomjs")
20
    def testJavaScriptCode(self):
21
        subprocess.call(
22
            ["mocha-phantomjs", "FuzzEd/tests/js-tests/src/test_runner.html"])
23