
import os
import sys

try:
    import nose
except ImportError:
    recommend = (
        "pip install nose" if "VIRTUAL_ENV" in os.environ else
        "sudo easy_install nose"
    )
    sys.stderr.write(
        "Running the tests requires Nose. Try:\n\n{cmd}\n\nAborting.\n"
        .format(cmd=recommend)
    )
    sys.exit(1)


nose.main()


import os
import sys

try:
    import nose
except ImportError:
    recommend = (
        "pip install nose unittest2 -r requirements.txt" if
        "VIRTUAL_ENV" in os.environ else
        "sudo easy_install nose unittest2 richenum"
    )
    sys.stderr.write(
        "Running the tests requires Nose. Try:\n\n{cmd}\n\nAborting.\n"
        .format(cmd=recommend)
    )
    sys.exit(1)


args = [] if "distutils" in sys.modules else sys.argv[1:]

nose.main(argv=['nosetests'] + args)

Make sure tests run on 'setup.py test'
Make sure tests run on 'setup.py test'

Nose was parsing the argv passed to setup.py (oh, global variables).
Assume that if 'distutils' are loaded then this is the case; and pass
through argv if it isn't.  Also, update the suggested commands for the
extra requirements.

  
  import os
  import sys
  
  try:
      import nose
  except ImportError:
      recommend = (
+         "pip install nose unittest2 -r requirements.txt" if
-         "pip install nose" if "VIRTUAL_ENV" in os.environ else
+         "VIRTUAL_ENV" in os.environ else
-         "sudo easy_install nose"
+         "sudo easy_install nose unittest2 richenum"
      )
      sys.stderr.write(
          "Running the tests requires Nose. Try:\n\n{cmd}\n\nAborting.\n"
          .format(cmd=recommend)
      )
      sys.exit(1)
  
  
- nose.main()
+ args = [] if "distutils" in sys.modules else sys.argv[1:]
  
+ nose.main(argv=['nosetests'] + args)
+ 
Make sure tests run on 'setup.py test'
## Code Before:

import os
import sys

try:
    import nose
except ImportError:
    recommend = (
        "pip install nose" if "VIRTUAL_ENV" in os.environ else
        "sudo easy_install nose"
    )
    sys.stderr.write(
        "Running the tests requires Nose. Try:\n\n{cmd}\n\nAborting.\n"
        .format(cmd=recommend)
    )
    sys.exit(1)


nose.main()

## Instruction:
Make sure tests run on 'setup.py test'
## Code After:

import os
import sys

try:
    import nose
except ImportError:
    recommend = (
        "pip install nose unittest2 -r requirements.txt" if
        "VIRTUAL_ENV" in os.environ else
        "sudo easy_install nose unittest2 richenum"
    )
    sys.stderr.write(
        "Running the tests requires Nose. Try:\n\n{cmd}\n\nAborting.\n"
        .format(cmd=recommend)
    )
    sys.exit(1)


args = [] if "distutils" in sys.modules else sys.argv[1:]

nose.main(argv=['nosetests'] + args)
