Skip to content

Conversation

@theGowda
Copy link
Contributor

Added async support. Uses asyncio.open_connection which provied StreamReader and Writer

@theGowda
Copy link
Contributor Author

Sorry about the previous PR #302 it was wrong

@theGowda
Copy link
Contributor Author

should pass all checks now.
Need to add tests for all async part

@theGowda
Copy link
Contributor Author

@luqasz any thoughts on this?

@luqasz
Copy link
Owner

luqasz commented Nov 27, 2024

@theGowda Do you want to add tests ?

@theGowda
Copy link
Contributor Author

@theGowda Do you want to add tests ?

I have never written async tests. Basically have to copy everything with async await.
I'll create another folder inside test for async tests

@luqasz
Copy link
Owner

luqasz commented Dec 3, 2024

@theGowda you can run tests locally.

@theGowda
Copy link
Contributor Author

theGowda commented Dec 3, 2024

@theGowda you can run tests locally.

Ya the integration tests passed.
I am updating the unit tests

@luqasz
Copy link
Owner

luqasz commented Dec 3, 2024

@theGowda you can run tests locally.

Ya the integration tests passed. I am updating the unit tests

https://github.com/luqasz/librouteros/actions/runs/12126034808/job/33859566156

@theGowda
Copy link
Contributor Author

theGowda commented Dec 3, 2024

@theGowda you can run tests locally.

Ya the integration tests passed. I am updating the unit tests

https://github.com/luqasz/librouteros/actions/runs/12126034808/job/33859566156

I had to install pytest-asyncio as dev dependency for the async tests. Is that causing it? Because tests seem to pass locally.
I'll check

@luqasz
Copy link
Owner

luqasz commented Dec 4, 2024

pyproject.toml changed significantly since poetry.lock was last generated. Run `poetry lock [--no-update]` to fix the lock file.

Everything is written in actions output.

@theGowda
Copy link
Contributor Author

theGowda commented Dec 4, 2024

pyproject.toml changed significantly since poetry.lock was last generated. Run `poetry lock [--no-update]` to fix the lock file.

Everything is written in actions output.

i'll complete the unit tests and push a commit

@luqasz
Copy link
Owner

luqasz commented Dec 5, 2024

Async integration tests are failing. Looks like it can't connect. You can download docker images with routeros vms.

@theGowda
Copy link
Contributor Author

theGowda commented Dec 5, 2024

Async integration tests are failing. Looks like it can't connect. You can download docker images with routeros vms.

But I dont understand why it is failing. I ran integration tests locally using qcow2 images as suggested in the readme file.
Worked fine.

I'll check with your images

@luqasz
Copy link
Owner

luqasz commented Dec 5, 2024

Maybe increase timeout in async_connect()

commit dca389e
Author: theGowda <sachin08gowda@gmail.com>
Date:   Fri Dec 6 19:46:10 2024 +0530

    remove comment

commit 32b7e79
Author: theGowda <sachin08gowda@gmail.com>
Date:   Fri Dec 6 19:17:00 2024 +0530

    mypy fix

commit 923af8d
Author: theGowda <sachin08gowda@gmail.com>
Date:   Fri Dec 6 19:11:58 2024 +0530

    increased timeout

commit 8c50e0a
Author: theGowda <sachin08gowda@gmail.com>
Date:   Fri Dec 6 14:08:33 2024 +0530

    fix test

commit 9a3f942
Author: theGowda <sachin08gowda@gmail.com>
Date:   Fri Dec 6 13:43:13 2024 +0530

    increase async timeout in tests
@theGowda
Copy link
Contributor Author

theGowda commented Dec 6, 2024

Maybe increase timeout in async_connect()

changed it to 60 for now in tests

@theGowda
Copy link
Contributor Author

theGowda commented Dec 6, 2024

@luqasz can you please re-run the failed tests. it will pass.

@luqasz
Copy link
Owner

luqasz commented Dec 6, 2024

/__w/librouteros/librouteros/.venv/lib/python3.8/site-packages/pytest_asyncio/plugin.py:208: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

Pytest throws this warning both ni unit and integration tests.

@theGowda
Copy link
Contributor Author

theGowda commented Dec 6, 2024

/__w/librouteros/librouteros/.venv/lib/python3.8/site-packages/pytest_asyncio/plugin.py:208: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset.
The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

Pytest throws this warning both ni unit and integration tests.

That's fine. Just a warning. Its about the asyncio loop. I don't think it'll affect the functioning in our case

@luqasz
Copy link
Owner

luqasz commented Dec 6, 2024

OK. Final review.

@luqasz
Copy link
Owner

luqasz commented Dec 6, 2024

@theGowda can you please move integration/async into `integration ? IMO it's unnecessary to duplicate fixture code. Adding async tests into existing files will be fine.

@theGowda
Copy link
Contributor Author

theGowda commented Dec 7, 2024

@theGowda can you please move integration/async into `integration ? IMO it's unnecessary to duplicate fixture code. Adding async tests into existing files will be fine.

Okay. I'll move the tests

@theGowda
Copy link
Contributor Author

theGowda commented Dec 8, 2024

@luqasz i think you sould stop the test for python 3.12. its been running for 10mins now

@luqasz
Copy link
Owner

luqasz commented Dec 8, 2024

Seems that on 3.12 tests timeout but only for routeros 6.33.3. Does those run locally ?

@theGowda
Copy link
Contributor Author

theGowda commented Dec 8, 2024

Seems that on 3.12 tests timeout but only for routeros 6.33.3. Does those run locally ?

Yes. Github action succeeded in my fork.
Screenshot 2024-12-08 at 8 16 03 PM

@theGowda theGowda requested a review from luqasz December 8, 2024 18:47
@luqasz luqasz merged commit 8770d1d into luqasz:main Dec 9, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants