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

pytest_subprocess.asyncio_subprocess has no attribute 'DEVNULL' #63

Closed
jranieri-grammatech opened this issue Dec 12, 2021 · 1 comment · Fixed by #66
Closed

pytest_subprocess.asyncio_subprocess has no attribute 'DEVNULL' #63

jranieri-grammatech opened this issue Dec 12, 2021 · 1 comment · Fixed by #66

Comments

@jranieri-grammatech
Copy link

fake_process appears to be incompatible with code that uses asyncio.subprocess.DEVNULL.

Example test:

def test_devnull(fake_process):
    async def impl():
        process = await asyncio.create_subprocess_exec(
            "cat",
            stdin=oasyncio.subprocess.DEVNULL,
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE,
        )

    fake_process.register_subprocess("cat")
    asyncio.get_event_loop().run_until_complete(impl())

Output:

E       AttributeError: module 'pytest_subprocess.asyncio_subprocess' has no attribute 'DEVNULL'

From looking at asyncio_subprocess.py, my guess would be that DEVNULL needs to be imported here (and probably STDOUT too) .

@aklajnert
Copy link
Owner

Thanks for the report, this one was easy so I've fixed it immediately.

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

Successfully merging a pull request may close this issue.

2 participants