question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests should run without network access and be consistent in PyPi

See original GitHub issue

Is your feature request related to a problem? Please describe. I package various Azure SDK components in Fedora Linux for use with azure-cli, and one of my frustrations is around running tests. During RPM builds, no network access is allowed. However, many of the SDK tests require network access or they have a VCR cassette that is outdated. This prevents me from running tests.

I’ve reviewed how Arch and Debian packagers are handling this challenge and many of them are disabling many tests or simply not testing at all. To make matters worse, some of the PyPi packages for certain SDK components contain tests, and some do not. Some of them contain the VCR recordings for tests, and others do not. This requires me to get the source code from the git repository so I can be sure I have all of the tests and recordings. However, I must download the entire repository (> 100MB) just to get the 1-2MB of code that I really care about.

Some tests, such as the ones for azure-mgmt-network, require me to run docker during tests, which includes downloading a remote container.

Describe the solution you’d like I’d like to see:

  • SDK tests run without network dependencies
  • Tests and VCR recordings either included or excluded consistently in PyPi packages

Describe alternatives you’ve considered Sometimes I have to disable some or all of the tests for a particular part of the SDK. For some, such as azure-mgmt-network, I must disable all of the tests to build the package successfully. This creates issues later when I get bugs from users or when I package azure-cli and its tests break when importing command modules.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
msyyccommented, Jul 12, 2022

We do include tests in sdist but recording files are not included since current recording files are .json files after migration to testproxy. We will update the template to ensure the recording files are included in sdist.

1reaction
l0lawrencecommented, Jun 27, 2022

Hi @major, thanks for the feedback. We will investigate asap.

Read more comments on GitHub >

github_iconTop Results From Across the Web

policytester - Kubernetes Network Policy Tester - PyPI
This is where the policy tester comes in. The tool is written in python and uses existing pods running in a kubernetes cluster...
Read more >
Building and testing Python - GitHub Docs
This guide shows you how to build, test, and publish a Python package. GitHub-hosted runners have a tools cache with pre-installed software, which...
Read more >
User Guide - pip documentation v22.3.1
When installing packages from PyPI, pip requires internet access, which in many corporate environments requires an outbound HTTP proxy server.
Read more >
Create a PyPI (pip) package, test it and publish it using Github ...
Let's create an access token which will allow us to upload to TestPyPI without having to type in our email and password all...
Read more >
Effective Python Testing With Pytest
By placing disable_network_calls() in conftest.py and adding the autouse=True option, you ensure that network calls will be disabled in every ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found