Skip to content

Move unit tests and enable them for pull requests#291

Merged
psss merged 7 commits into
mainfrom
psss-unit-tests
Mar 30, 2026
Merged

Move unit tests and enable them for pull requests#291
psss merged 7 commits into
mainfrom
psss-unit-tests

Conversation

@psss
Copy link
Copy Markdown
Owner

@psss psss commented Jan 27, 2023

Some unit tests need a special setup but most of them should be working without authentication. Let's enable at least the basic set for pull request testing.

@lukaszachy lukaszachy added this to the 0.22 milestone Feb 9, 2024
Comment thread tests/unit/test_cli.py Fixed
@sandrobonazzola
Copy link
Copy Markdown
Collaborator

Can you please rebase?

@psss psss modified the milestones: 0.22, 0.23 Jun 3, 2025
@sandrobonazzola
Copy link
Copy Markdown
Collaborator

@psss rebased here: https://github.com/sandrobonazzola/did/tree/psss-unit-tests , feel free to take from there.

@psss psss force-pushed the psss-unit-tests branch from 6bdd72c to 9e1e788 Compare June 9, 2025 11:16
@psss
Copy link
Copy Markdown
Owner Author

psss commented Jun 9, 2025

Thanks, rebased and removed the extra tmt plan.

@psss psss force-pushed the psss-unit-tests branch from 9e1e788 to 392eb20 Compare June 9, 2025 11:53
@psss psss force-pushed the psss-unit-tests branch from 9f6483e to fdffdc0 Compare June 9, 2025 12:52
@psss psss force-pushed the psss-unit-tests branch from d3862a8 to bce98d5 Compare June 10, 2025 15:14
@sandrobonazzola sandrobonazzola force-pushed the psss-unit-tests branch 2 times, most recently from aacad15 to f475858 Compare June 17, 2025 11:48
@sandrobonazzola
Copy link
Copy Markdown
Collaborator

Looks like tests are failing accessing the local git repo:

 Unable to access git repo '/var/ARTIFACTS/work-basicsjs9qk36/plans/basic/discover/default-0/tests/tests'

@psss psss force-pushed the psss-unit-tests branch 2 times, most recently from cdbb465 to bb89df0 Compare March 27, 2026 15:44
@psss psss force-pushed the psss-unit-tests branch from bb89df0 to b2016eb Compare March 30, 2026 09:33
psss added 2 commits March 30, 2026 12:24
The collect ignore does not work with older pytest:

```
  File "/usr/lib/python3.9/site-packages/pluggy/manager.py", line 252, in _verify_hook
    raise PluginValidationError(
pluggy.manager.PluginValidationError: Plugin '/var/ARTIFACTS/work-basiciy0u5a0r/plans/basic/discover/default-0/tests/conftest.py' for hook 'pytest_ignore_collect'
hookimpl definition: pytest_ignore_collect(collection_path, config) -> bool
Argument(s) {'collection_path'} are declared in the hookimpl but can not be found in the hookspec
```

Let's just skip centos stream for now.
```
/usr/lib64/python3.14/xmlrpc/client.py:1258: in send_request
    connection.putrequest("POST", handler, skip_accept_encoding=True)
        connection = <http.client.HTTPSConnection object at 0x7efc7c2f7e30>
        debug      = False
        handler    = '/rpc'
        headers    = []
        host       = 'localhost'
        request_body = (b"<?xml version='1.0'?>\n<methodCall>\n<methodName>ticket.query</methodName>"
 b'\n<params>\n<param>\n<value><string>time=..2026-03-31&amp;modified=2026-03-'
 b'30..&amp;max=1000000</string></value>\n</param>\n</params>\n</methodCall>\n')
        self       = <xmlrpc.client.SafeTransport object at 0x7efc7bdd05f0>

self = <http.client.HTTPSConnection object at 0x7efc7c2f7e30>, method = 'POST'
url = '/rpc', skip_host = False, skip_accept_encoding = True

    def putrequest(self, method, url, skip_host=False,
                   skip_accept_encoding=False):
        """Send a request to the server.

        'method' specifies an HTTP request method, e.g. 'GET'.
        'url' specifies the object being requested, e.g. '/index.html'.
        'skip_host' if True does not add automatically a 'Host:' header
        'skip_accept_encoding' if True does not add automatically an
           'Accept-Encoding:' header
        """

        # if a prior response has been completed, then forget about it.
        if self.__response and self.__response.isclosed():
            self.__response = None

        # in certain cases, we cannot issue another request on this connection.
        # this occurs when:
        #   1) we are in the process of sending a request.   (_CS_REQ_STARTED)
        #   2) a response to a previous request has signalled that it is going
        #      to close the connection upon completion.
        #   3) the headers for the previous response have not been read, thus
        #      we cannot determine whether point (2) is true.   (_CS_REQ_SENT)
        #
        # if there is no prior response, then we can request at will.
        #
        # if point (2) is true, then we will have passed the socket to the
        # response (effectively meaning, "there is no prior response"), and
        # will open a new one when a new request is made.
        #
        # Note: if a prior response exists, then we *can* start a new request.
        #       We are not allowed to begin fetching the response to this new
        #       request, however, until that prior response is complete.
        #
        if self.__state == _CS_IDLE:
            self.__state = _CS_REQ_STARTED
        else:
>           raise CannotSendRequest(self.__state)
E           http.client.CannotSendRequest: Request-sent
```
Copy link
Copy Markdown
Collaborator

@sandrobonazzola sandrobonazzola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@psss psss merged commit 1dbda72 into main Mar 30, 2026
17 checks passed
@psss psss deleted the psss-unit-tests branch March 30, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants