CleanCut / green

Green is a clean, colorful, fast python test runner.
MIT License
791 stars 75 forks source link

Running a specific test with a syntax error results in 'No Tests Found' #129

Closed mairsbw closed 8 years ago

mairsbw commented 8 years ago

I modified a test and introduced a syntax error. I then called the test using a class-specific path like python -m green my_program.test.test_1 -vv, where the output was:

Ran 0 tests in 4.376s

No Tests Found

But then if I change how I run it like python -m green my_program then I see the Traceback with the SyntaxError:

Traceback (most recent call last):
  File "c:\Program Files\Python35\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\Program Files\Python35\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Program Files\Python35\lib\site-packages\green\__main__.py", line 7, in <module>
    sys.exit(main())
  File "c:\Program Files\Python35\lib\site-packages\green\cmdline.py", line 75, in main
    result = run(test_suite, stream, args, testing)
  File "c:\Program Files\Python35\lib\site-packages\green\runner.py", line 92, in run
    targets = [(target, manager.Queue()) for target in toParallelTargets(suite, args.targets)]
  File "c:\Program Files\Python35\lib\site-packages\green\loader.py", line 60, in toParallelTargets
    proto_test_list = toProtoTestList(suite)
  File "c:\Program Files\Python35\lib\site-packages\green\loader.py", line 45, in toProtoTestList
    toProtoTestList(i, test_list, doing_completions)
  File "c:\Program Files\Python35\lib\site-packages\green\loader.py", line 45, in toProtoTestList
    toProtoTestList(i, test_list, doing_completions)
  File "c:\Program Files\Python35\lib\site-packages\green\loader.py", line 45, in toProtoTestList
    toProtoTestList(i, test_list, doing_completions)
  File "c:\Program Files\Python35\lib\site-packages\green\loader.py", line 45, in toProtoTestList
    toProtoTestList(i, test_list, doing_completions)
  File "c:\Program Files\Python35\lib\site-packages\green\loader.py", line 37, in toProtoTestList
    getattr(suite, exception_method)()
  File "c:\Program Files\Python35\lib\site-packages\green\loader.py", line 235, in testFailure
    raise ImportError(message)
ImportError: Failed to import pixtitch.test.test_indices computed from filename my_program\test\test_1.py
Traceback (most recent call last):
  File "c:\Program Files\Python35\lib\site-packages\green\loader.py", line 212, in loadFromModuleFilename
    __import__(dotted_module)
  File "my_program\test\test_1.py", line 113
    red[:] = [500, 0, 500 0]
                          ^
SyntaxError: invalid syntax
CleanCut commented 8 years ago

One of the fixes in 2.5.1 may have covered this situation. Please try 2.5.1 out and report what you find.

mairsbw commented 8 years ago

Indeed, looks to be fixed as of 2.5.1. Thanks!

CleanCut commented 8 years ago

Awesome!

CleanCut commented 8 years ago

@skeggse Thanks again for the fix!