Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove the python 3.7 #566

Closed

Conversation

MuhammadHasnain77
Copy link

No description provided.

@OrangeTux
Copy link
Collaborator

Thanks for your PR. It's still missing a few things, though.

See #565 for a list it things that need to be done.

@MuhammadHasnain77
Copy link
Author

check it out is it correct.

@OrangeTux
Copy link
Collaborator

OrangeTux commented Jan 10, 2024

The asynctest dependency is still referenced in the tests. See:

$ ag asynctest tests/ -B5
tests/v201/conftest.py
1-try:
2-    from unittest.mock import AsyncMock
3-except ImportError:
4-    # Python 3.7 and below don't include unittest.mock.AsyncMock. Hence,
5-    # we need to resolve to a package on pypi.
6:    from asynctest import CoroutineMock as AsyncMock

tests/v16/conftest.py
1-try:
2-    from unittest.mock import AsyncMock
3-except ImportError:
4-    # Python 3.7 and below don't include unittest.mock.AsyncMock. Hence,
5-    # we need to resolve to a package on pypi.
6:    from asynctest import CoroutineMock as AsyncMock

tests/conftest.py
1-try:
2-    from unittest.mock import AsyncMock
3-except ImportError:
4-    # Python 3.7 and below don't include unittest.mock.AsyncMock. Hence,
5-    # we need to resolve to a package on pypi.
6:    from asynctest import CoroutineMock as AsyncMock

tests/v20/conftest.py
1-try:
2-    from unittest.mock import AsyncMock
3-except ImportError:
4-    # Python 3.7 and below don't include unittest.mock.AsyncMock. Hence,
5-    # we need to resolve to a package on pypi.
6:    from asynctest import CoroutineMock as AsyncMock

Those references must be removed.

Also, the poetry.lock still lists asynctest. Make sure to run poetry lock --no-update to generate a new lockfile.

@MuhammadHasnain77
Copy link
Author

See is it correct

@MuhammadHasnain77
Copy link
Author

I have completely remove all the python 3.7 version from the required files aslo asynctest

Comment on lines +7 to +9
if sys.version_info < (3, 8):
from asynctest import CoroutineMock as AsyncMock

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in this PR aim to drop support for Python 3.7. Therefore, this code is not needed.
Even if you run the code with Python 3.7, it would fails. Since the dependency asynctest has been removed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to remove import sys, since that module isn't used anymore.

Comment on lines 3 to 11
try:
from unittest.mock import AsyncMock
except ImportError:
# Python 3.7 and below don't include unittest.mock.AsyncMock. Hence,
# we need to resolve to a package on pypi.
from asynctest import CoroutineMock as AsyncMock

if sys.version_info < (3, 8):
from asynctest import CoroutineMock as AsyncMock
else:
AsyncMock = None # Set to None for Python 3.8 and above
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these lines in favor of :

from unittest.mock import AsyncMock

MuhammadHasnain77

This comment was marked as resolved.

Copy link
Author

@MuhammadHasnain77 MuhammadHasnain77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check it out its now correct?

# we need to resolve to a package on pypi.
from asynctest import CoroutineMock as AsyncMock

import sys
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys is not used. Please remove it.

tests/v16/conftest.py Outdated Show resolved Hide resolved
Comment on lines +7 to +9
if sys.version_info < (3, 8):
from asynctest import CoroutineMock as AsyncMock

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to remove import sys, since that module isn't used anymore.

@OrangeTux
Copy link
Collaborator

OrangeTux commented Jan 15, 2024

No its not ready yet, please read my all my comments.

Co-authored-by: Auke Willem Oosterhoff <1565144+OrangeTux@users.noreply.github.com>
@Jared-Newell-Mobility
Copy link
Collaborator

Sorry, this issue became important to resolve, so I have opened a PR to replace it in this OCPP library - #585 - therefore, I will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants