Fix bad log statement

Review Request #2290 - Created May 29, 2015 and submitted

Information
Andy Reitz
pants
43aa23d...
Reviewers
pants-reviews
chrischen, fkorotkov
Fix bad log statement

Before:

[drift pants (master)]$ PANTS_DEV=1 ./pants test examples/tests/java/org/pantsbuild/example/hello/greet --test-junit-test=Success#test_good2
...
23:22:00 00:00     [junit]
23:22:00 00:00       [run]
                     WARN] Scrubbing JAVA_TOOL_OPTIONS=-Dfile.encoding=utf8
Auto-detected 8 processors, using -parallel-threads=8
                     Exception in thread "main" java.lang.RuntimeException: Classloading error during test discovery for Success#test_good2
                        at org.pantsbuild.tools.junit.ConsoleRunner.notFoundError(ConsoleRunner.java:509)
                        at org.pantsbuild.tools.junit.ConsoleRunner.parseRequests(ConsoleRunner.java:396)
                        at org.pantsbuild.tools.junit.ConsoleRunner.run(ConsoleRunner.java:273)
                        at org.pantsbuild.tools.junit.ConsoleRunner.main(ConsoleRunner.java:646)
                     Caused by: java.lang.ClassNotFoundException: Success
                        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
                        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
                        at java.security.AccessController.doPrivileged(Native Method)
                        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
                        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
                        at java.lang.Class.forName0(Native Method)
                        at java.lang.Class.forName(Class.java:270)
                        at org.pantsbuild.tools.junit.ConsoleRunner.loadClass(ConsoleRunner.java:442)
                        at org.pantsbuild.tools.junit.ConsoleRunner.parseRequests(ConsoleRunner.java:382)
                        ... 2 more
                     FATAL: Error during test discovery for Success#test_good2: java.lang.ClassNotFoundException: Success

23:22:00 00:00   [complete]
               FAILURE

Exception caught:
  File "/Users/andyr/workspace/pants/src/python/pants/bin/pants_exe.py", line 86, in <module>
    main()
  File "/Users/andyr/workspace/pants/src/python/pants/bin/pants_exe.py", line 81, in main
    _run(exiter)
  File "/Users/andyr/workspace/pants/src/python/pants/bin/pants_exe.py", line 74, in _run
    result = goal_runner.run()
  File "/Users/andyr/workspace/pants/src/python/pants/bin/goal_runner.py", line 212, in run
    result = self._do_run()
  File "/Users/andyr/workspace/pants/src/python/pants/bin/goal_runner.py", line 269, in _do_run
    return engine.execute(context, self.goals)
  File "/Users/andyr/workspace/pants/src/python/pants/engine/engine.py", line 26, in execute
    self.attempt(context, goals)
  File "/Users/andyr/workspace/pants/src/python/pants/engine/round_engine.py", line 212, in attempt
    goal_executor.attempt(explain)
  File "/Users/andyr/workspace/pants/src/python/pants/engine/round_engine.py", line 45, in attempt
    task.execute()
  File "/Users/andyr/workspace/pants/src/python/pants/backend/jvm/tasks/junit_run.py", line 768, in execute
    self._runner.execute(targets)
  File "/Users/andyr/workspace/pants/src/python/pants/backend/jvm/tasks/junit_run.py", line 155, in execute
    self.run(tests_and_targets, junit_classpath)
  File "/Users/andyr/workspace/pants/src/python/pants/backend/jvm/tasks/junit_run.py", line 184, in run
    self._run_tests(tests_and_targets, junit_classpath, JUnitRun._MAIN)
  File "/Users/andyr/workspace/pants/src/python/pants/backend/jvm/tasks/junit_run.py", line 284, in _run_tests
    failed_targets = self._get_failed_targets(tests_and_targets)
  File "/Users/andyr/workspace/pants/src/python/pants/backend/jvm/tasks/junit_run.py", line 246, in _get_failed_targets
    self._context.log.warning('Unknown target for test %{0}'.format(test))

Exception message: 'Log' object has no attribute 'warning'

After:

[drift pants (master)]$ PANTS_DEV=1 ./pants test examples/tests/java/org/pantsbuild/example/hello/greet --test-junit-test=Success#test_good2
...
23:22:17 00:00     [junit]
23:22:17 00:00       [run]
                     WARN] Scrubbing JAVA_TOOL_OPTIONS=-Dfile.encoding=utf8
Auto-detected 8 processors, using -parallel-threads=8
                     Exception in thread "main" java.lang.RuntimeException: Classloading error during test discovery for Success#test_good2
                        at org.pantsbuild.tools.junit.ConsoleRunner.notFoundError(ConsoleRunner.java:509)
                        at org.pantsbuild.tools.junit.ConsoleRunner.parseRequests(ConsoleRunner.java:396)
                        at org.pantsbuild.tools.junit.ConsoleRunner.run(ConsoleRunner.java:273)
                        at org.pantsbuild.tools.junit.ConsoleRunner.main(ConsoleRunner.java:646)
                     Caused by: java.lang.ClassNotFoundException: Success
                        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
                        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
                        at java.security.AccessController.doPrivileged(Native Method)
                        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
                        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
                        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
                        at java.lang.Class.forName0(Native Method)
                        at java.lang.Class.forName(Class.java:270)
                        at org.pantsbuild.tools.junit.ConsoleRunner.loadClass(ConsoleRunner.java:442)
                        at org.pantsbuild.tools.junit.ConsoleRunner.parseRequests(ConsoleRunner.java:382)
                        ... 2 more
                     FATAL: Error during test discovery for Success#test_good2: java.lang.ClassNotFoundException: Success

                   Unknown target for test %Success#test_good2
FAILURE: java org.pantsbuild.tools.junit.ConsoleRunner ... exited non-zero (1)


23:22:18 00:01   [complete]
               FAILURE
Chris Chen
Eric Ayers
Andy Reitz
Andy Reitz
Review request changed

Status: Closed (submitted)

Loading...