Closed amotl closed 1 year ago
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
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.
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 https://github.com/hiveeyes/terkin-datalogger/issues/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.
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.
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.
# 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
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
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
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/
Hi again,
after a bit more fiddling at https://github.com/hiveeyes/terkin-datalogger/pull/116, it now works like a charm. Thank you so much for the exceptional quick fix and release!
With kind regards, Andreas.
Dear Giorgio,
while giving some love to Terkin, and creating https://github.com/hiveeyes/terkin-datalogger/pull/116, I also wanted to report about another issue which blocked me from upgrading to
mocket-3.10.x
already.It looks like the
_address
attribute moved toMocketSocket
, so it can't be addressed on theMocket
instance anymore. Is there anything you could do about it?With kind regards, Andreas.