Skip to content

Changed assertions and fixtures#1379

Open
1rvine wants to merge 2 commits into
AcademySoftwareFoundation:mainfrom
1rvine:main
Open

Changed assertions and fixtures#1379
1rvine wants to merge 2 commits into
AcademySoftwareFoundation:mainfrom
1rvine:main

Conversation

@1rvine

@1rvine 1rvine commented Aug 9, 2022

Copy link
Copy Markdown

Link the Issue(s) this Pull Request is related to.

Each PR should link at least one issue, in the form:

This pull request was initiated as a part of a CodeDay mentorship program.

Partially addresses #1228

Use one line for each Issue. This allows auto-closing the related issue when the fix is merged.

Replaced unittest assertions with Pytest assertions and replaced setup and teardown methods with python fixtures

Describe the reason for the change.

Add a list of changes, and note any that might need special attention during review.

test_core.py & test_opentime.py

If no new tests are introduced as part of this PR, note the tests that are providing coverage.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 9, 2022

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: 1rvine / name: Irvine (fc34f30)

@reinecke reinecke left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like it's coming along!

In addition to the specific notes I gave, here are some more general notes to apply broadly across the PR:

  • It looks like the build failed mostly due to linting errors. Check out PEP 8 and The Black code style to get familiar with python code style guidelines.
  • Simple assertions (like assert (t.value == 0) or assert(tr.contains(tstart))) should not include the parens, they can just be written as assert t.value == 0 or assert tr.contains(tstart)
  • Since the goal of the PR is to move from unittest to pytest, try removing the import unittest from the top of the files. What errors pop up when you run the tests? Those are all things that moving to pytest's standards will help address.

Comment thread tests/test_core.py Outdated
Comment thread tests/test_core.py Outdated
Comment thread tests/test_core.py Outdated
Comment thread tests/test_core.py Outdated
Comment thread tests/test_core.py Outdated
@@ -5,17 +5,17 @@
import shutil
import tempfile
import unittest

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since this PR is aiming to switch from unittest to pytest, I'd look at the uses of unittest within this module and see if you can replace them with pytest equivalents.

One example I see is the usage of the @unittest.skipUnless decorator - this can be replaced by "inverting" the logic on the test case and using @pytest.mark.skipif instead.

Comment thread tests/test_opentime.py Outdated
Comment thread tests/test_opentime.py Outdated
Comment thread tests/test_opentime.py Outdated
Comment thread tests/test_opentime.py Outdated
Comment thread tests/test_core.py Outdated
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