Skip to content

py.test occurred error in selenium "AttributeError: 'NoneType' object has no attribute 'fork_exec'" #1365

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

Closed
neoneo40 opened this issue Feb 7, 2016 · 2 comments

Comments

@neoneo40
Copy link

neoneo40 commented Feb 7, 2016

from time import sleep

from good.common import Date

def test_example(selenium):
    # print(base_url)
    base_url = 'http://google.com'
    selenium.get('{0}'.format(base_url))
    sleep(2)

Error

  • I tried to delete "from good.common import Date". didn't occurred error.
  • I wrote "from good.common import Date" in source then error occurred.
  • I don't know why error occurred.
(reservation)λ ~/PycharmProjects/reservation/ master* py.test tests/test_selenium.py -s --driver Firefox
============================================== test session starts ===============================================
platform darwin -- Python 3.5.0, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
rootdir: /Users/re4lfl0w/PycharmProjects/reservation, inifile:
plugins: capturelog-0.7, cov-2.2.0, django-2.9.1, html-1.7, selenium-1.1, variables-1.3, xdist-1.13.1
collected 1 items

tests/test_selenium.py E

===================================================== ERRORS =====================================================
_________________________________________ ERROR at setup of test_example _________________________________________

request = <SubRequest 'selenium' for <Function 'test_example'>>, capabilities = {}

    @pytest.fixture
    def selenium(request, capabilities):
        """Returns a WebDriver instance based on options and capabilities"""
        from .driver import start_driver
>       driver = start_driver(request.node, capabilities)

../../.virtualenvs/reservation/lib/python3.5/site-packages/pytest_selenium/pytest_selenium.py:75:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.virtualenvs/reservation/lib/python3.5/site-packages/pytest_selenium/driver.py:26: in start_driver
    options.driver.lower()))(item, _capabilities)
../../.virtualenvs/reservation/lib/python3.5/site-packages/pytest_selenium/driver.py:66: in firefox_driver
    return webdriver.Firefox(**kwargs)
../../.virtualenvs/reservation/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py:78: in __init__
    self.binary, timeout)
../../.virtualenvs/reservation/lib/python3.5/site-packages/selenium/webdriver/firefox/extension_connection.py:49: in __init__
    self.binary.launch_browser(self.profile)
../../.virtualenvs/reservation/lib/python3.5/site-packages/selenium/webdriver/firefox/firefox_binary.py:67: in launch_browser
    self._start_from_profile_path(self.profile.path)
../../.virtualenvs/reservation/lib/python3.5/site-packages/selenium/webdriver/firefox/firefox_binary.py:90: in _start_from_profile_path
    env=self._firefox_env)
/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py:950: in __init__
    restore_signals, start_new_session)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <subprocess.Popen object at 0x10640d048>
args = ['/Applications/Firefox.app/Contents/MacOS/firefox-bin', '-foreground']
executable = b'/Applications/Firefox.app/Contents/MacOS/firefox-bin', preexec_fn = None, close_fds = True
pass_fds = (), cwd = None
env = {'Apple_PubSub_Socket_Render': '/private/tmp/com.apple.launchd.dnGQ9QgDof/Render', 'COMMAND_MODE': 'unix2003', 'COMP_WORDBREAKS': '', 'DISPLAY': '/private/tmp/com.apple.launchd.y0hUNcloen/org.macosforge.xquartz:0', ...}
startupinfo = None, creationflags = 0, shell = False, p2cread = -1, p2cwrite = -1, c2pread = -1, c2pwrite = 6
errread = -1, errwrite = 6, restore_signals = True, start_new_session = False

    def _execute_child(self, args, executable, preexec_fn, close_fds,
                       pass_fds, cwd, env,
                       startupinfo, creationflags, shell,
                       p2cread, p2cwrite,
                       c2pread, c2pwrite,
                       errread, errwrite,
                       restore_signals, start_new_session):
        """Execute program (POSIX version)"""

        if isinstance(args, (str, bytes)):
            args = [args]
        else:
            args = list(args)

        if shell:
            args = ["/bin/sh", "-c"] + args
            if executable:
                args[0] = executable

        if executable is None:
            executable = args[0]
        orig_executable = executable

        # For transferring possible exec failure from child to parent.
        # Data format: "exception name:hex errno:description"
        # Pickle is not used; it is complex and involves memory allocation.
        errpipe_read, errpipe_write = os.pipe()
        # errpipe_write must not be in the standard io 0, 1, or 2 fd range.
        low_fds_to_close = []
        while errpipe_write < 3:
            low_fds_to_close.append(errpipe_write)
            errpipe_write = os.dup(errpipe_write)
        for low_fd in low_fds_to_close:
            os.close(low_fd)
        try:
            try:
                # We must avoid complex work that could involve
                # malloc or free in the child process to avoid
                # potential deadlocks, thus we do all this here.
                # and pass it to fork_exec()

                if env is not None:
                    env_list = [os.fsencode(k) + b'=' + os.fsencode(v)
                                for k, v in env.items()]
                else:
                    env_list = None  # Use execv instead of execve.
                executable = os.fsencode(executable)
                if os.path.dirname(executable):
                    executable_list = (executable,)
                else:
                    # This matches the behavior of os._execvpe().
                    executable_list = tuple(
                        os.path.join(os.fsencode(dir), executable)
                        for dir in os.get_exec_path(env))
                fds_to_keep = set(pass_fds)
                fds_to_keep.add(errpipe_write)
>               self.pid = _posixsubprocess.fork_exec(
                        args, executable_list,
                        close_fds, sorted(fds_to_keep), cwd, env_list,
                        p2cread, p2cwrite, c2pread, c2pwrite,
                        errread, errwrite,
                        errpipe_read, errpipe_write,
                        restore_signals, start_new_session, preexec_fn)
E                       AttributeError: 'NoneType' object has no attribute 'fork_exec'

/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py:1473: AttributeError
@RonnyPfannschmidt
Copy link
Member

looks like a broken interpreter, not pytest

@RonnyPfannschmidt
Copy link
Member

im closing this as the error does not come from pytest itself and no further feedback was provided

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

No branches or pull requests

2 participants