Consolidate pure unit tests out of test_ssl.py

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Tests
    • None
    • Python Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      Follow-up to PYTHON-5930 / #2965.

      Several tests in test/asynchronous/test_ssl.py have no async/sync variation. PYTHON-5930 moved only its own new tests into the non-mirrored test/test_ssl_support.py. This ticket covers the rest, plus tests that no longer assert anything.

      Definition of done

      Move into test/test_ssl_support.py:

      • test_use_pyopenssl_when_available
      • test_get_ssl_session_pyopenssl_style
      • test_get_ssl_session_stdlib_style
      • test_tls_session_reused_on_second_connection — already @skipUnless(_IS_SYNC)

      Delete or repair:

      • test_ssl_session_cache — asserts only that assigning to a list element works
      • test_certifi_support, test_wincertstore — skip on hasattr(ssl, "SSLContext"), always true on Python 3
      • test_system_certs_config_error — skips on hasattr(ctx, "load_default_certs"), true for both context types

      Acceptance criteria: nothing is duplicated without a flavor-specific reason; nothing in test_ssl.py skips unconditionally; moved tests use PyMongoTestCase and the cert constants from test/helpers_shared.py.

      Pitfalls

      • Not every unit-looking test is a duplicate. test_no_ssl_module and test_config_ssl build MongoClient vs AsyncMongoClient; the unreachable tests pass _IS_SYNC as get_ssl_context's is_sync, selecting PyOpenSSL vs stdlib. Moving these drops async coverage silently.
      • The five test_async_* session tests are @skipUnless(not _IS_SYNC). If moved, use a new test/asynchronous/test_ssl_async_sessions.py added to async_only_test() in tools/synchro.py — not test_ssl_support.py, which would make the sync file look mirrored.
      • test_ssl_support.py is named for pymongo/ssl_support.py, but the session tests target pymongo/pool_shared.py. Accept the looser scope or rename up front.

            Assignee:
            Unassigned
            Reporter:
            Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: