Comments (7)
I had a look again at what you did. It's definitely something I have never seen before, but it works, and the fix was super-easy.
Here is a new Mocket version for you: https://pypi.org/project/mocket/3.10.9/
from python-mocket.
Hi @amotl, I had a look at your project and I noticed the way you are using mocket
is very uncommon.
You don't seem to be using its decorator nor its context manager, which is probably the reason why Mocket
does not have that attribute set properly (connect
is not happening inside Mocket's scope).
Could you please help me with a snippet of code that fail the same way as your tests?
The _address
attribute wasn't moved, this is the only recent change related to it:
https://github.com/mindflayer/python-mocket/pull/183/files#diff-bdbad69094211a1bec191da22004fa4eea8ed1e953a16e52da1e442036f18b47R430
from python-mocket.
I even see you are creating a MocketEntry
with (None, None
) as location
, which makes no sense because no client would try to connect to that couple of non-existing host/port.
from python-mocket.
Dear Giorgio,
thanks a stack for taking the time to look into this, and for discovering our irregular use of Mocket
. I have to admit I did not look too closely when "just bumping some development dependencies" ;].
So, it appears that we will have to do our homework and review/modify our usage of Mocket
accordingly. On that matter, I want to avoid bothering you any longer about it, and diverted this issue back to hiveeyes/terkin-datalogger#117 again.
I even see you are creating a MocketEntry with (None, None) as location, which makes no sense because no client would try to connect to that couple of non-existing host/port.
I think that was needed to support the irregular socket.AF_LORA
socket type, which completely lacks the host/port addressing scheme.
Thank you again and with kind regards,
Andreas.
from python-mocket.
Nevertheless, @amotl let me know if you need any kind of support on my end, no matter if it's for something Mocket supports at the moment or not.
from python-mocket.
Dear Giorgio,
your offer is very kind. However, I don't have any other specific need for help other than offering a detailed reproduction, if you are really keen enough that you would like to look directly into the issue on behalf of the code base where I have been observing it.
If you can quickly spot what I was doing wrong, and see an immediate solution, I will be more than happy. Otherwise, please don't waste your valuable time on this matter. The workable solution is to just downgrade to mocket-3.9.x
, so it is currently not a blocker for the evolution of Terkin - however it may well become in the future.
With kind regards,
Andreas.
Success
# Acquire sources and create sandbox environment.
git clone https://github.com/hiveeyes/terkin-datalogger
cd terkin-datalogger/
python3.10 -m venv .venv310
source .venv310/bin/activate
# Install dependency packages from PyPI.
pip install --editable=.[lorawan] --requirement=requirements-test.txt
# Install more requirements manually. We will have to improve this.
wget https://raw.githubusercontent.com/daq-tools/micropython/improve-onewire/drivers/onewire/onewire.py --output-document=dist-packages/onewire_native.py
wget https://raw.githubusercontent.com/micropython/micropython/v1.11/drivers/onewire/ds18x20.py --output-document=dist-packages/ds18x20_native.py
wget https://raw.githubusercontent.com/robert-hh/BME280/79ccf348ec674f15c92a1debf1aceb383db38321/bme280_float.py --output-document=dist-packages/bme280_float.py
# Run specific set of software tests, to save cycles.
pytest test/test_lorawan.py
Error
See it failing after upgrading to most recent version of mocket
.
pip install mocket --upgrade
pytest --no-cov test/test_lorawan.py -k test_uplink_system_temperature
Works again
Make it work again by downgrading to mocket-3.9.x
.
pip install "mocket<3.10" --upgrade
pytest --no-cov test/test_lorawan.py -k test_uplink_system_temperature
from python-mocket.
Hi again,
after a bit more fiddling at hiveeyes/terkin-datalogger#116, it now works like a charm. Thank you so much for the exceptional quick fix and release!
With kind regards,
Andreas.
from python-mocket.
Related Issues (20)
- Cannot inject HTTPX client as pytest fixture HOT 9
- Support for `fastapi`.`TestClient` HOT 36
- Support for asyncpg HOT 2
- Server respond first upon client connect HOT 1
- Question / feature request: using truesocket recording mode for an in-process HTTP server HOT 9
- Does not work with urllib3 >= 2.0.0 HOT 7
- Question: function responses and regex HOT 5
- Add type hints to improve codebase readability and enable static type checking HOT 7
- Feature Request / Question - Mocking with proxies HOT 5
- Errors with aiohttp 3.8.6 HOT 5
- Documentation on direct socket mocking? HOT 4
- Async example fails on Python 3.11 when URL is changed to HTTPS HOT 6
- Enable pook for newer Python versions HOT 4
- Can't make a mixture of unmocked and mocked HTTPS requests using aiohttp HOT 1
- Can't make an HTTPS request with 'no verify' mode using aiohttp when Mocket is active HOT 1
- "Too many open files" error when making many mocked async requests HOT 1
- Feature request: allow specifying exceptions to strict mode HOT 2
- Establishing connections against multiple hosts can cause true socket connection to get created against the wrong host
- Issue using big response object in Entry with async client HOT 11
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 python-mocket.