|
5 | 5 | import traceback
|
6 | 6 | import types
|
7 | 7 | import warnings
|
8 |
| - |
| 8 | +import copy |
9 | 9 | import six
|
10 | 10 | import py
|
11 | 11 | # DON't import pytest here because it causes import cycle troubles
|
@@ -68,7 +68,7 @@ def main(args=None, plugins=None):
|
68 | 68 | return 4
|
69 | 69 |
|
70 | 70 |
|
71 |
| -class cmdline(object): # compatibility namespace |
| 71 | +class cmdline(object): # NOQA compatibility namespace |
72 | 72 | main = staticmethod(main)
|
73 | 73 |
|
74 | 74 |
|
@@ -845,19 +845,6 @@ def _ensure_removed_sysmodule(modname):
|
845 | 845 | pass
|
846 | 846 |
|
847 | 847 |
|
848 |
| -class CmdOptions(object): |
849 |
| - """ holds cmdline options as attributes.""" |
850 |
| - |
851 |
| - def __init__(self, values=()): |
852 |
| - self.__dict__.update(values) |
853 |
| - |
854 |
| - def __repr__(self): |
855 |
| - return "<CmdOptions %r>" % (self.__dict__,) |
856 |
| - |
857 |
| - def copy(self): |
858 |
| - return CmdOptions(self.__dict__) |
859 |
| - |
860 |
| - |
861 | 848 | class Notset(object):
|
862 | 849 | def __repr__(self):
|
863 | 850 | return "<NOTSET>"
|
@@ -885,7 +872,7 @@ class Config(object):
|
885 | 872 | def __init__(self, pluginmanager):
|
886 | 873 | #: access to command line option as attributes.
|
887 | 874 | #: (deprecated), use :py:func:`getoption() <_pytest.config.Config.getoption>` instead
|
888 |
| - self.option = CmdOptions() |
| 875 | + self.option = argparse.Namespace() |
889 | 876 | _a = FILE_OR_DIR
|
890 | 877 | self._parser = Parser(
|
891 | 878 | usage="%%(prog)s [options] [%s] [%s] [...]" % (_a, _a),
|
@@ -989,7 +976,7 @@ def pytest_load_initial_conftests(self, early_config):
|
989 | 976 | self.pluginmanager._set_initial_conftests(early_config.known_args_namespace)
|
990 | 977 |
|
991 | 978 | def _initini(self, args):
|
992 |
| - ns, unknown_args = self._parser.parse_known_and_unknown_args(args, namespace=self.option.copy()) |
| 979 | + ns, unknown_args = self._parser.parse_known_and_unknown_args(args, namespace=copy.copy(self.option)) |
993 | 980 | r = determine_setup(ns.inifilename, ns.file_or_dir + unknown_args, warnfunc=self.warn,
|
994 | 981 | rootdir_cmd_arg=ns.rootdir or None)
|
995 | 982 | self.rootdir, self.inifile, self.inicfg = r
|
@@ -1054,7 +1041,8 @@ def _preparse(self, args, addopts=True):
|
1054 | 1041 | self.pluginmanager.consider_preparse(args)
|
1055 | 1042 | self.pluginmanager.load_setuptools_entrypoints('pytest11')
|
1056 | 1043 | self.pluginmanager.consider_env()
|
1057 |
| - self.known_args_namespace = ns = self._parser.parse_known_args(args, namespace=self.option.copy()) |
| 1044 | + self.known_args_namespace = ns = self._parser.parse_known_args( |
| 1045 | + args, namespace=copy.copy(self.option)) |
1058 | 1046 | if self.known_args_namespace.confcutdir is None and self.inifile:
|
1059 | 1047 | confcutdir = py.path.local(self.inifile).dirname
|
1060 | 1048 | self.known_args_namespace.confcutdir = confcutdir
|
|
0 commit comments