Open deuxpi opened 9 years ago
Existence is not enough. Many systems can't distinguish between a non-existent environment variable, and an empty one. Try setting it to a value: export NOSE_IGNORE_CONFIG_FILES=1
.
Running nosetests
with envvar set works, setuptools command doesn't:
$ NOSE_IGNORE_CONFIG_FILES=1 nosetests
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
----------------------------------------------------------------------
Ran 0 tests in 0.001s
OK
$ NOSE_IGNORE_CONFIG_FILES=1 python setup.py nosetests
running nosetests
running egg_info
writing UNKNOWN.egg-info/PKG-INFO
writing top-level names to UNKNOWN.egg-info/top_level.txt
writing dependency_links to UNKNOWN.egg-info/dependency_links.txt
reading manifest file 'UNKNOWN.egg-info/SOURCES.txt'
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
Usage: setup.py [options]
setup.py: error: Error reading config file '/home/phil/.noserc': no such option 'with-yanc'
After simple patch:
diff --git a/nose/commands.py b/nose/commands.py
index ef0e9ca..c8fb447 100644
--- a/nose/commands.py
+++ b/nose/commands.py
@@ -64,6 +64,7 @@ try:
except ImportError:
Command = nosetests = None
else:
+ import os
from nose.config import Config, option_blacklist, user_config_files, \
flag, _bool
from nose.core import TestProgram
@@ -88,7 +89,11 @@ else:
class nosetests(Command):
description = "Run unit tests using nosetests"
- __config = Config(files=user_config_files(),
+ if os.environ.get('NOSE_IGNORE_CONFIG_FILES', False):
+ cfg_files = []
+ else:
+ cfg_files = user_config_files()
+ __config = Config(files=cfg_files,
plugins=DefaultPluginManager())
__parser = __config.getParser()
user_options = get_user_options(__parser)
$ NOSE_IGNORE_CONFIG_FILES=1 python setup.py nosetests
running nosetests
running egg_info
writing UNKNOWN.egg-info/PKG-INFO
writing top-level names to UNKNOWN.egg-info/top_level.txt
writing dependency_links to UNKNOWN.egg-info/dependency_links.txt
reading manifest file 'UNKNOWN.egg-info/SOURCES.txt'
writing manifest file 'UNKNOWN.egg-info/SOURCES.txt'
----------------------------------------------------------------------
Ran 0 tests in 0.002s
OK
It looks like we have something similar going on for the direct nosetests invocation too. Okay, I'll add it to the queue. The patch will probably take a little different shape though to avoid setting a cfg_files
class variable.
Thanks! Can I do anything to help?
For me this would also be a perfect work-around/fix for https://github.com/nose-devs/nose/issues/800.
If you don't mind reworking your patch to avoid creating another class variable, that would be great. Perhaps some helper method somewhere in the file, or an "y if x else z" sort of construct?
When running nosetests from the
python setup.py nosetests
command, the user configuration in ~/.noserc is always evaluated, regardless of theexistencevalue of a NOSE_IGNORE_CONFIG_FILES environment variable.Edit: clarified as per @jszakmeister 's comment