Skip to content

Conversation

blink1073
Copy link
Member

No description provided.

@ShaneHarvey
Copy link
Member

Assuming the 3.11 tests pass let's add the 3.11 trove classifier too.

@blink1073
Copy link
Member Author

blink1073 commented Oct 6, 2022

Failures that were pre-existing in recent build:

  • test_dns_record_lookup_empty (test_srv_polling.TestSrvPolling)
  • test_dns_failures (test_srv_polling.TestSrvPolling)
  • test_srv_polling.TestSrvPolling.test_dns_failures
  • test_srv_polling.TestSrvPolling.test_dns_record_lookup_empty
  • [2022/10/06 21:02:41.676] Running command 'shell.exec' in "run enterprise auth tests" (step 2 of 2). [2022/10/06 21:09:54.828] Command ''shell.exec' in "run enterprise auth tests"' failed: shell script encountered problem: exit code 1. src

New failures:

@ShaneHarvey
Copy link
Member

 [2022/10/06 21:40:11.633] ERROR: test_corpus (test.test_encryption.TestCorpus.test_corpus)
 [2022/10/06 21:40:11.633] ----------------------------------------------------------------------
 [2022/10/06 21:40:11.633] Traceback (most recent call last):
 [2022/10/06 21:40:11.633]   File "C:\data\mci\ccc3b9397cdce05218603e98ad57b081\src\pymongo\encryption.py", line 76, in _wrap_encryption_errors
 [2022/10/06 21:40:11.633]     yield
 [2022/10/06 21:40:11.633]   File "C:\data\mci\ccc3b9397cdce05218603e98ad57b081\src\pymongo\encryption.py", line 364, in encrypt
 [2022/10/06 21:40:11.633]     encrypted_cmd = self._auto_encrypter.encrypt(database, encoded_cmd)
 [2022/10/06 21:40:11.633]                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 [2022/10/06 21:40:11.633]   File "Z:\data\mci\ccc3b9397cdce05218603e98ad57b081\src\venv-encryption\Lib\site-packages\pymongocrypt\auto_encrypter.py", line 44, in encrypt
 [2022/10/06 21:40:11.633]     return run_state_machine(ctx, self.callback)
 [2022/10/06 21:40:11.633]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 [2022/10/06 21:40:11.633]   File "Z:\data\mci\ccc3b9397cdce05218603e98ad57b081\src\venv-encryption\Lib\site-packages\pymongocrypt\state_machine.py", line 150, in run_state_machine
 [2022/10/06 21:40:11.633]     callback.kms_request(kms_ctx)
 [2022/10/06 21:40:11.633]   File "C:\data\mci\ccc3b9397cdce05218603e98ad57b081\src\pymongo\encryption.py", line 142, in kms_request
 [2022/10/06 21:40:11.633]     data = conn.recv(kms_context.bytes_needed)
 [2022/10/06 21:40:11.633]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 [2022/10/06 21:40:11.633]   File "C:\python\Python311\Lib\ssl.py", line 1263, in recv
 [2022/10/06 21:40:11.633]     return self.read(buflen)
 [2022/10/06 21:40:11.633]            ^^^^^^^^^^^^^^^^^
 [2022/10/06 21:40:11.633]   File "C:\python\Python311\Lib\ssl.py", line 1136, in read
 [2022/10/06 21:40:11.633]     return self._sslobj.read(len)
 [2022/10/06 21:40:11.633]            ^^^^^^^^^^^^^^^^^^^^^^
 [2022/10/06 21:40:11.633] TimeoutError: The read operation timed out

Interesting, is this a fluke or does it happen consistently?

@blink1073
Copy link
Member Author

I kicked the task and it passed

)
# The repr() of an enum changed in Python 3.11.
if sys.version_info >= (3, 11):
r = r.replace("DatetimeConversion.DATETIME", str(DatetimeConversion.DATETIME))
Copy link
Member

Choose a reason for hiding this comment

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

We should fix CodecOptions.__repr__ to avoid changing behavior.

Copy link
Member

Choose a reason for hiding this comment

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

Also do you know if this was an intentional change? Could it be a python bug?

Copy link
Member Author

Choose a reason for hiding this comment

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

We're actually using the str() representation, and it is an intentional change:

IntEnum used to subclass int, Enum and now it subclasses int, ReprEnum.:

"Changed in version 3.11: str() is now int.str() to better support the replacement of existing constants use-case. format() was already int.format() for that same reason."

Copy link
Member

Choose a reason for hiding this comment

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

can we use format (f-string) instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so. If we had been going the other direction we could have specified int() formatting, but we'd have to basically recreate the old str() repr ourselves:

f'{DatetimeConversion.DATETIME_AUTO}'
'4'

Copy link
Member

Choose a reason for hiding this comment

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

I think we can use class DatetimeConversion(int, enum.Enum) to keep the old behavior.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

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

One last question

@blink1073 blink1073 marked this pull request as draft October 11, 2022 16:49
@ShaneHarvey
Copy link
Member

 [2022/10/11 16:54:43.381] FAIL [0.001s]: test_must_connect (test_client_context.TestClientContext.test_must_connect)
 [2022/10/11 16:54:43.381] ----------------------------------------------------------------------
 [2022/10/11 16:54:43.381] Traceback (most recent call last):
 [2022/10/11 16:54:43.381]   File "/data/mci/6d8fe5eaf124547d0611aa2dab642ffd/src/test/test_client_context.py", line 28, in test_must_connect
 [2022/10/11 16:54:43.381]     self.assertTrue(
 [2022/10/11 16:54:43.381] AssertionError: False is not true : client context must be connected when PYMONGO_MUST_CONNECT is set. Failed attempts:
 [2022/10/11 16:54:43.381] failed to connect client MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True, serverselectiontimeoutms=5000): 'bytes' object has no attribute 'is_absolute', Timeout: 5.0s, Topology Description: <TopologyDescription id: 63459f235735d3dee7ba4219, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AttributeError("'bytes' object has no attribute 'is_absolute'")>]>
 [2022/10/11 16:54:43.381] failed to connect client MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True, serverselectiontimeoutms=5000, tls=True, tlscertificatekeyfile='/data/mci/6d8fe5eaf124547d0611aa2dab642ffd/src/test/certificates/client.pem', tlscafile='/data/mci/6d8fe5eaf124547d0611aa2dab642ffd/src/test/certificates/ca.pem'): 'bytes' object has no attribute 'is_absolute', Timeout: 5.0s, Topology Description: <TopologyDescription id: 63459f285735d3dee7ba421a, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AttributeError("'bytes' object has no attribute 'is_absolute'")>]>

This error was fixed by PYTHON-3451.

Copy link
Member

@ShaneHarvey ShaneHarvey left a comment

Choose a reason for hiding this comment

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

Could we merge this PR and push out the 3.11 gevent testing fix and the 3.11 macos wheels to a new ticket?

# Install the framework from pip.
# Use the same flags as the ones used by gevent, in case we have to build the wheel.
$PYTHON -m pip install --upgrade pip wheel setuptools
$PYTHON -m pip install $GREEN_FRAMEWORK
Copy link
Member

Choose a reason for hiding this comment

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

Is this using a venv? If not we need to create one first before pip installing anything.

Copy link
Member Author

Choose a reason for hiding this comment

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

It was not, I'll add a note in the new ticket

@blink1073
Copy link
Member Author

Could we merge this PR and push out the 3.11 gevent testing fix and the 3.11 macos wheels to a new ticket?

Yep, sounds good

@blink1073
Copy link
Member Author

@blink1073 blink1073 marked this pull request as ready for review October 12, 2022 21:58
@blink1073 blink1073 requested a review from ShaneHarvey October 12, 2022 21:58
@blink1073 blink1073 merged commit df77653 into mongodb:master Oct 13, 2022
@blink1073 blink1073 deleted the PYTHON-3347 branch October 13, 2022 11:09
blink1073 added a commit to blink1073/mongo-python-driver that referenced this pull request Oct 19, 2022
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