Skip to content

Conversation

@smokestacklightnin
Copy link
Member

@smokestacklightnin smokestacklightnin commented Oct 23, 2024

Changes in this PR:

  • Add unit test GitHub workflow for Python 3.9, 3.10, and 3.11
  • Use unittest for running unit tests. I tried using pytest, but there pickling errors when I did that.
  • Add unittest skips or expectedFailures to tests with errors or failures
  • Remove imports for mdoules that aren't part of the open source repo. Tests will not run if the imports are present because the corresponding modules are absent.
  • Add tf-keras as a dependency. Tests fail without this.

You can get a list of tests with skips or expectedFailures using

$ grep -nr "PR 189" tensorflow_model_analysis

@smokestacklightnin smokestacklightnin self-assigned this Oct 23, 2024
Copy link
Member

@aktech aktech left a comment

Choose a reason for hiding this comment

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

Other than the nitpicks, it looks good to me.

@smokestacklightnin
Copy link
Member Author

smokestacklightnin commented Oct 24, 2024

@embr This PR seems to me to be ready for review and merge. It just adds a testing workflow. I think fixing the failing tests can come from subsequent work.

The test failure is because of an import error. The import refers to code that is "in maintenance mode" and "not available in TFMA OSS". Until the code becomes present in tfma.eval_saved_model, the tests will not pass.

@peytondmurray
Copy link
Contributor

I'm going to update the branch. If we have failing tests, let's mark them as XFAIL here, then make a PR to remove the missing imports - now that this is officially community maintained, we shouldn't keep tests around for code we will never see here.

…rom `AttributeError: module 'tensorflow_model_analysis' has no attribute 'EvalConfig'`

These are to be addressed in a future PR
@smokestacklightnin smokestacklightnin force-pushed the ci/testing/add-workflow-with-unittest branch from 441f05a to 3849ac9 Compare July 4, 2025 23:09
@smokestacklightnin smokestacklightnin force-pushed the ci/testing/add-workflow-with-unittest branch from 662caa2 to a9e43e6 Compare July 11, 2025 05:21
@smokestacklightnin smokestacklightnin force-pushed the ci/testing/add-workflow-with-unittest branch from a7b33ab to a3812b9 Compare July 11, 2025 06:05
@smokestacklightnin smokestacklightnin force-pushed the ci/testing/add-workflow-with-unittest branch from 542f1fa to 47de67f Compare July 15, 2025 00:11
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y protobuf-compiler libprotobuf-c-dev
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 believe these are sufficient for protobufs to be build, but I'm not sure they're both/all strictly necessary.

@smokestacklightnin
Copy link
Member Author

smokestacklightnin commented Jul 15, 2025

@peytondmurray Tests are all passing or xfailed!

Will clean up the PR and ping you for review

@smokestacklightnin smokestacklightnin force-pushed the ci/testing/add-workflow-with-unittest branch from 49b1b85 to f00949b Compare July 15, 2025 04:52
Copy link
Contributor

@peytondmurray peytondmurray left a comment

Choose a reason for hiding this comment

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

Just a a couple of comments.

- name: Run unit tests
shell: bash
run: |
python -m unittest discover -p "*_test.py"
Copy link
Contributor

Choose a reason for hiding this comment

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

How come we don't use pytest here?

Copy link
Member Author

Choose a reason for hiding this comment

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

This has to do with pickling errors in pytest that aren't present in unit test

@peytondmurray peytondmurray merged commit 6a31f33 into tensorflow:master Jul 15, 2025
5 checks passed
@peytondmurray peytondmurray deleted the ci/testing/add-workflow-with-unittest branch July 15, 2025 22:29
nightly='>=1.18.0.dev',
git_master='@git+https://github.com/tensorflow/tfx-bsl@master',
),
'tf-keras',
Copy link
Member Author

Choose a reason for hiding this comment

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

@embr tests fail without this, but I was wondering if this should be a dependency for the whole package, or only a test dependency.

CC: @peytondmurray

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.

3 participants