Run synchro on changed async files when running tests

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Infrastructure
    • None
    • Python Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      As a follow up to PYTHON-5890, we could improve the local testing usability by synchronizing any of the async files that have changed before running the tests, to make sure we are not testing the old code on the synch path.

      The original attempt in https://github.com/mongodb/mongo-python-driver/pull/2887 was not quite correct because it would run the synchro script without input, running it across all of the files. My first attempt at a fix was to skip running ruff in https://github.com/mongodb/mongo-python-driver/pull/2889, but in that case, you would run the synchro script and all of the files would be in a changed state because we rely on ruff to adjust the files for us.

      I think the right way to do it is when the CI environment variable is not set, and there are no files passed to the script, it should use the git information to find which files have changed, and use that to filter against the known async files. It should still skip the ruff check and format when running from just test or just run-tests, but it should run the unasync_files function on the appropriate files.

      Definition of done

      Demonstrate that after making a change to an async file that has a linting error, when running just test, that file is synchronized and tested.

      Pitfalls

      Make sure we don't break the existing workflows for git commit and CI checks.

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

              Created:
              Updated: