You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by GitBox <gi...@apache.org> on 2022/05/11 13:45:09 UTC

[GitHub] [libcloud] ogayot opened a new pull request, #1692: tests/test_connection.py: fix test failing when https_proxy is set

ogayot opened a new pull request, #1692:
URL: https://github.com/apache/libcloud/pull/1692

   ## tests/test_connection.py: fix test failing when https_proxy is set
   
   ### Description
   
   Hello,
   
   In tests/test_connection.py, We have code in setUp & tearDown functions to make tests run properly if the http_proxy variable is already present in the environment when running tests.
   
   For each test, the code:
   * backs up the http_proxy variable (if it exists)
   * clears the environment variable
   * runs the test (sometimes the tests override the http_proxy variable; as in test_constructor)
   * restores the variable to its original value (or clears it is we didn't back up any value)
   
   However, we would also need to handle the HTTPS counterpart, the https_proxy variable. Running tests with this variable set currently fails with:
   
   ```
             self.assertIsNone(conn.proxy_scheme)
       E       AssertionError: 'http' is not None
   
       libcloud/test/test_connection.py:127: AssertionError
   ```
   some of Ubuntu's autopkgtest fail because of that.
   
   This patch adds the same logic that we have for HTTP, but for the HTTPS counterpart.
   
   Test case:
   
   ```bash
   $ https_proxy=http://squid.internal:3128 python3 -m pytest test/test_connection.py
   ```
   
   I also removed the tearDownClass method that was clearing up the http_proxy variable unconditionally ; which could have side effects. We already have code that restores the http_proxy variable (or clear it) in the tearDown function so there is no need to do it twice.
   
   Best regards,
   Olivier
   
   ### Status
   
   - done, ready for review
   
   ### Checklist (tick everything that applies)
   
   - [x] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide) (required, can be done after the PR checks)
   - [ ] Documentation
   - [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
   - [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes) (required for bigger changes)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [libcloud] Kami merged pull request #1692: tests/test_connection.py: fix test failing when https_proxy is set

Posted by GitBox <gi...@apache.org>.
Kami merged PR #1692:
URL: https://github.com/apache/libcloud/pull/1692


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org