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

Message: failed on setup with "PermissionError: [WinError 5] Access is denied" #428

Closed
kawess91 opened this issue May 21, 2021 · 2 comments

Comments

@kawess91
Copy link

Hello I am new to pytest-postgresql. I am getting a PermissionError: [WinError 5] Access is denied error, even when running my code as administrator.

I am running on Windows 10

What action do you want to perform

Create a postgresql factory

my code:

import pytest
from pytest_postgresql import factories
import sqlalchemy
import os

pg_executable = "C:/Program Files/PostgreSQL/11/bin"
#pg_executable =os.environ.get("PG_EXECUTABLE")

postgresql_proc = factories.postgresql_proc(logs_prefix="pytest-", port=5432,executable=pg_executable, dbname="test")

fixture holding an instance of a psycopg2 connection

postgresql= factories.postgresql("postgresql_proc")
#factories.po

def test_postgresql_proc(postgresql_proc):
"""Test different postgresql versions."""
assert postgresql_proc.running() is True

@pytest.fixture(scope="function")
def pg_engine(postgresql):
return sqlalchemy.create_engine("postgresql+psycopg2://", poolclass=sqlalchemy.pool.StaticPool, creator=lambda: postgresql)

def test_isinstance(pg_engine):
assert isinstance(pg_engine,sqlalchemy.engine.base.Engine)

What are the results

failed on setup with "PermissionError: [WinError 5] Access is denied"

What are the expected results

true
true

@fizyk
Copy link
Member

fizyk commented May 21, 2021

@kawess91 I'm sorry, but I don't support windows at the moment. I'm slowly attempting to introduce it, but it can be only as good as I can make it work through github actions. And I use windows only as a gaming, so there might be some mistakes in understanding.

What's important to note that I'd need to adjust mirakuru, a process orchestration library first, and there's a pull request:
ClearcodeHQ/mirakuru#454
Some tests are still skipped as I need to understand if changes are need to the library ir it's tests and how to introduce them maintaining compatibility with all these platforms

I'll mark this issue as a duplicate for #303 though, I'm not able to look forward on windows issues without preliminary support... Unless You'd like to take a look and see what could be fixed/adjusted ?

@kawess91
Copy link
Author

Hello @fizyk and thank you for your quick response. I tried postgresql_noproc instead and it seems to be working (as in #303 ). I searched on internet and it seems to be related to windows and permissions when trying to launch the "CreateProcess" . I found this: https://stackoverflow.com/questions/3005437/windowserror-error-5-access-is-denied that may be a beginning of a solution

@fizyk fizyk closed this as completed Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants