Uploaded image for project: ' Swift for TensorFlow'
  1. Swift for TensorFlow
  2. TF-336

[Python] Add unit testing infrastructure for Python 2 and 3

    XMLWordPrintable

    Details

      Description

      Currently, we only have runtime tests for Python 2, not Python 3: test/Python/python_runtime.swift.

      It would be great to run all Python tests for both major versions.

      Dynamically switching Python versions is not possible (and we likely don't want it to be possible), so we can't simply run all tests in a loop and switch versions after every iteration. Instead, we can rig up lit tests to run test/Python/python_runtime.swift twice, once with PYTHON_VERSION=2 and once with PYTHON_VERSION=3.


      Note by Dan Zheng: the idea below (moving tests to a PythonUnittest module) is not ideal. I should have deleted it after commenting a better alternative idea.

      • Move all tests to a shared module stdlib/privatte/PythonUnittest. This prevents code duplication.
      • Create two test files: test/Python/python2_runtime.swift and test/Python/python3_runtime.swift. Let them call Python.useVersion, then import and run all tests.

        Attachments

          Activity

            People

            Assignee:
            vguerra Victor Guerra
            Reporter:
            danzheng Dan Zheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: