Comments (4)
@miketheman oops, sorry--life errands came up & this briefly fell off my radar. I've now made the modification & pushed; I believe it should be ready to merge now.
from pytest-socket.
Hi @kwshi ! Thanks for the in-depth details here. I'll attempt to address a couple of these:
Fixes section
requests
is used in some of the tests but not specified as a test/dev dependency. Installingrequests
fixes one of the issues.
requests
comes along from the starlette
package's extras
, as seen here: https://github.com/encode/starlette/blob/e45c5793611bfec606cd9c5d56887ddc67f77c38/setup.py#L52
I've never had to directly express that dependency for the tests, as it comes along automatically from poetry
- not 100% certain how yet, but it works 🎉
If you'd have to set other test dependencies like starlette
on your test setup, adding requests
there ought to solve the issue.
Several of the source files have lines that are too long & other formatting errors...
Looks like the flake8 config file isn't included in the dist package either - as it sets the limit to 160 chars.
The E122 error is triggered on the generated setup.py
file - so that'd be an issue to raise with Poetry, not this project.
I'm also thinking that adding the flake8 flag to pytest is better for those that modify the code (against this repo) vs a package maintainer that is less likely to modify the code, rather only test it? I'm undecided here.
Side notes section
For both items -
One of the benefits of using something like poetry
is that I can get a virtual environment, install the package into the current python scope, use pytest
cli directly, as now the PYTHONPATH
does not need to be changed to try and find the package.
I can then dispose of the virtualenv at will.
Most of the routine testing is also performed via GitHub Actions, which is ephemeral and I don't mind if the package is installed, as the entire environment goes away at the end of the test.
from pytest-socket.
Ah I see! Thanks for the thorough response--
If you'd have to set other test dependencies like starlette on your test setup, adding requests there ought to solve the issue.
Interesting--I wasn't testing using Poetry, so that explains the difference. Indeed, I was just wondering whether starlette
should be added to the list of dev/test dependencies in pyproject.toml
, but it sounds like that's not actually necessary.
Looks like the flake8 config file isn't included in the dist package either - as it sets the limit to 160 chars.
Cool, I'll amend my PR to add this.
The E122 error is triggered on the generated setup.py file - so that'd be an issue to raise with Poetry, not this project.
Makes sense!
Most of the routine testing is also performed via GitHub Actions, which is ephemeral and I don't mind if the package is installed, as the entire environment goes away at the end of the test.
I see. Well, for future reference for others who wish to try to run tests without installation or poetry (e.g. other people trying to make this into a package), the way to do so would be to
python setup.py egg_info
to generate metadata to help pytest detect it as a plugin;python -m pytest
to run pytest with the correctPYTHONPATH
detection.
from pytest-socket.
Looks like the flake8 config file isn't included in the dist package either - as it sets the limit to 160 chars.
Cool, I'll amend my PR to add this.
@kwshi I don't think the PR has been amended, and I was waiting for that to be added before merging. Is that something you still wish to pursue?
from pytest-socket.
Related Issues (20)
- Incompatibility with pytest-flakes? HOT 2
- `remove_host_restrictions` functionality no longer in the public interface HOT 3
- 0.5.0: pytest is failing in `tests/test_async.py::test_starlette` unit HOT 4
- pytest-socket blocks retrieving other dependencies HOT 1
- Issue with sockets when trying to run Home Assistant tests HOT 2
- 0.5.1: pytest is failing in `tests/test_async.py::test_httpx_fails` unit HOT 11
- Question about asynctest and Python 3.8+ compatibility HOT 3
- Action Required: Fix Renovate Configuration
- dd-trace calls in separate thread do not fail test HOT 7
- Allow host masks HOT 2
- Allow private networks only HOT 5
- Issue with latest pytest-socket version while using testcontainers HOT 6
- Try replacement for httpbin HOT 1
- Do not install files directly to site-packages HOT 2
- --allow-hosts list is normalized but connection host is not HOT 5
- Update Python version support HOT 1
- vscode-python version 2023.20.0 breaks disable_socket expected behavior HOT 2
- Option to only block `connect` calls? HOT 2
- 0.7.0: test suite fails HOT 6
- Add similar mock
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-socket.