Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-n auto and tox on windows does not work #52

Open
matthiasha opened this issue Mar 9, 2016 · 2 comments
Open

-n auto and tox on windows does not work #52

matthiasha opened this issue Mar 9, 2016 · 2 comments
Labels

Comments

@matthiasha
Copy link

multiprocessing.cpu_count() uses int(os.environ['NUMBER_OF_PROCESSORS']) to get the number of CPUs. I guess this does not work as tox cleans all the environment variables. Thus I suggest using another approach. There are several listed in http://stackoverflow.com/questions/1006289/how-to-find-out-the-number-of-cpus-using-python.

File "C:\Python27\Lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "C:\Python27\Lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\Scripts\py.test.EXE\__main__.py", line 9, in <module>
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\config.py", line 39, in main
    config = _prepareconfig(args, plugins)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\config.py", line 118, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 724, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 338, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 333, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 595, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 249, in _wrapped_call
    wrap_controller.send(call_outcome)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\helpconfig.py", line 28, in pytest_cmdline_parse
    config = outcome.get_result()
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 279, in get_result
    _reraise(*ex)  # noqa
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 264, in __init__
    self.result = func()
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 596, in execute
    res = hook_impl.function(*args)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\config.py", line 856, in pytest_cmdline_parse
    self.parse(args)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\config.py", line 961, in parse
    self._preparse(args, addopts=addopts)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\config.py", line 926, in _preparse
    self.known_args_namespace = ns = self._parser.parse_known_args(args, namespace=self.option.copy())
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\config.py", line 491, in parse_known_args
    return self.parse_known_and_unknown_args(args, namespace=namespace)[0]
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\_pytest\config.py", line 499, in parse_known_and_unknown_args
    return optparser.parse_known_args(args, namespace=namespace)
  File "C:\Python27\Lib\argparse.py", line 1720, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "C:\Python27\Lib\argparse.py", line 1926, in _parse_known_args
    start_index = consume_optional(start_index)
  File "C:\Python27\Lib\argparse.py", line 1866, in consume_optional
    take_action(action, args, option_string)
  File "C:\Python27\Lib\argparse.py", line 1778, in take_action
    argument_values = self._get_values(action, argument_strings)
  File "C:\Python27\Lib\argparse.py", line 2204, in _get_values
    value = self._get_value(action, arg_string)
  File "C:\Python27\Lib\argparse.py", line 2233, in _get_value
    result = type_func(arg_string)
  File "c:\windows\temp\devpi-test829\ngc-tsg-1.17.0.3687097\.tox\python\lib\site-packages\xdist\plugin.py", line 8, in parse_numprocesses
    return multiprocessing.cpu_count()
  File "C:\Python27\Lib\multiprocessing\__init__.py", line 136, in cpu_count
    raise NotImplementedError('cannot determine number of cpus')
NotImplementedError: cannot determine number of cpus
@RonnyPfannschmidt
Copy link
Member

@hpk42 can we consider this a tox bug and pass the cpu count on windows?

@matthiasha
Copy link
Author

cool, found a workaround:

[testenv]
passenv = NUMBER_OF_PROCESSORS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants