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

Does this work on windows at all? #625

Closed
07pepa opened this issue Jul 4, 2022 · 1 comment
Closed

Does this work on windows at all? #625

07pepa opened this issue Jul 4, 2022 · 1 comment

Comments

@07pepa
Copy link

07pepa commented Jul 4, 2022

What action do you want to perform

i am trying to test if this is compatiblewith windows with folowing code

def test_example_postgres(postgresql):
    """Check main postgresql fixture."""
    cur = postgresql.cursor()
    cur.execute("CREATE TABLE test (id serial PRIMARY KEY, num integer, data varchar);")
    postgresql.commit()
    cur.close()

What are the results

exception is thrown

test setup failed
request = <SubRequest 'postgresql' for <Function test_example_postgres>>

    @pytest.fixture
    def postgresql_factory(request: FixtureRequest) -> Iterator[connection]:
        """
        Fixture factory for PostgreSQL.
    
        :param request: fixture request object
        :returns: postgresql client
        """
        check_for_psycopg()
>       proc_fixture: Union[PostgreSQLExecutor, NoopExecutor] = request.getfixturevalue(
            process_fixture_name
        )

..\..\AppData\Roaming\Python\Python310\site-packages\pytest_postgresql\factories\client.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\..\AppData\Roaming\Python\Python310\site-packages\pytest_postgresql\factories\process.py:119: in postgresql_proc_fixture
    pg_port = get_port(port) or get_port(config["port"])
..\..\AppData\Roaming\Python\Python310\site-packages\port_for\api.py:169: in get_port
    return select_random(None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

ports = {5368, 5369, 5370, 5371, 5372, 5373, ...}, exclude_ports = set()

    def select_random(
        ports: Optional[Set[int]] = None,
        exclude_ports: Optional[Iterable[int]] = None,
    ) -> int:
        """
        Returns random unused port number.
        """
        if ports is None:
            ports = available_good_ports()
    
        if exclude_ports is None:
            exclude_ports = set()
    
        ports.difference_update(set(exclude_ports))
    
        for port in random.sample(tuple(ports), min(len(ports), 100)):
            if not port_is_used(port):
                return port
>       raise PortForException("Can't select a port")
E       port_for.exceptions.PortForException: Can't select a port

..\..\AppData\Roaming\Python\Python310\site-packages\port_for\api.py:34: PortForException

What are the expected results

  • windows should be suported
  • suported OS shoud be stated
  • instalation on untested OS should be disabled

system details

  • Python 3.10.4
  • Psycopg 3.0.15
  • pytest-postgresql 4.1.1
  • port-for 0.6.2
@fizyk
Copy link
Member

fizyk commented Jul 4, 2022

Duplicate: #303 and blocked by ClearcodeHQ/mirakuru#392

@fizyk fizyk closed this as completed Jul 4, 2022
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