
import os
import sys
from os.path import join, realpath

# Third Party modules
import nose
import coverage

cov = coverage.coverage(branch=True)

cov.start()
result = nose.run(defaultTest=realpath(join(__file__, "..", "..", "py2c")))
cov.stop()
cov.save()

if result == 0:
    # If we are in CI environment, don't write an HTML report.
    if os.environ.get("CI", None) is None:
        cov.html_report()

    cov.report()

sys.exit(result)


import os
import sys
from os.path import join, realpath

# Third Party modules
import nose
import coverage

cov = coverage.coverage(branch=True)

cov.start()
success = nose.run(defaultTest=realpath(join(__file__, "..", "..", "py2c")))
cov.stop()
cov.save()
if success:
    # If we are in CI environment, don't write an HTML report.
    if os.environ.get("CI", None) is None:
        cov.html_report()

    cov.report()

sys.exit(0 if success else 1)

Correct the usage of nose.run.
[TRAVIS] Correct the usage of nose.run.

nose.run returns whether the test run was sucessful or not.

  
  import os
  import sys
  from os.path import join, realpath
  
  # Third Party modules
  import nose
  import coverage
  
  cov = coverage.coverage(branch=True)
  
  cov.start()
- result = nose.run(defaultTest=realpath(join(__file__, "..", "..", "py2c")))
+ success = nose.run(defaultTest=realpath(join(__file__, "..", "..", "py2c")))
  cov.stop()
  cov.save()
+ if success:
- 
- if result == 0:
      # If we are in CI environment, don't write an HTML report.
      if os.environ.get("CI", None) is None:
          cov.html_report()
  
      cov.report()
  
- sys.exit(result)
+ sys.exit(0 if success else 1)
  
Correct the usage of nose.run.
## Code Before:

import os
import sys
from os.path import join, realpath

# Third Party modules
import nose
import coverage

cov = coverage.coverage(branch=True)

cov.start()
result = nose.run(defaultTest=realpath(join(__file__, "..", "..", "py2c")))
cov.stop()
cov.save()

if result == 0:
    # If we are in CI environment, don't write an HTML report.
    if os.environ.get("CI", None) is None:
        cov.html_report()

    cov.report()

sys.exit(result)

## Instruction:
Correct the usage of nose.run.
## Code After:

import os
import sys
from os.path import join, realpath

# Third Party modules
import nose
import coverage

cov = coverage.coverage(branch=True)

cov.start()
success = nose.run(defaultTest=realpath(join(__file__, "..", "..", "py2c")))
cov.stop()
cov.save()
if success:
    # If we are in CI environment, don't write an HTML report.
    if os.environ.get("CI", None) is None:
        cov.html_report()

    cov.report()

sys.exit(0 if success else 1)
