-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encapsulate NFTestAssert class, rewrite tests #67
Conversation
Argh, that's what I get for only running my new tests. |
Hmm, I'm not sure why this isn't working in the cloud - it works perfectly for me locally: $ pytest
======================================== test session starts ========================================
platform darwin -- Python 3.11.4, pytest-7.4.0, pluggy-1.0.0
rootdir: /Users/nwiltsie/src/tool-NFTest
collected 162 items
test/unit/test_NFTestAssert.py xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxx [ 38%]
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx..xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [ 88%]
test/unit/test_NFTestCase.py .. [ 90%]
test/unit/test_NFTestEnv.py .. [ 91%]
test/unit/test_NFTestRunner.py . [ 91%]
test/unit/test_common.py ......... [ 97%]
test/unit/test_syslog.py .... [100%]
================================== 22 passed, 140 xfailed in 1.96s ================================== |
Well, that's irritating. These log lines from this test from 4e71965 show that the filetimes are all wonky in GitHub Actions: DEBUG NFTest:NFTestAssert.py:44 Actual path `/tmp/pytest-of-runner/pytest-0/test_nftest_assert_True_md5_1_11/*.actual` resolved to `/tmp/pytest-of-runner/pytest-0/test_nftest_assert_True_md5_1_11/0.actual`
DEBUG NFTest:NFTestAssert.py:48 Expected path `/tmp/pytest-of-runner/pytest-0/test_nftest_assert_True_md5_1_11/*.expect` resolved to `/tmp/pytest-of-runner/pytest-0/test_nftest_assert_True_md5_1_11/0.expect`
DEBUG NFTest:NFTestAssert.py:57 Test creation time: 2024-06-24 23:30:14.720138+00:00
DEBUG NFTest:NFTestAssert.py:58 Actual mod time: 2024-06-24 23:30:14.716686+00:00 The only fix I can find is to insert |
Clearly there's something else going on under the hood. I'll dig in and try again later. |
Description
This PR rewrites most of the internals of
NFTestAssert
in a way that is (mostly) invisible to the outside world. This is the key interface change:The new
perform_assertions()
method hides all of the details ofidentify_assertion_files()
,assert_exists()
,assert_updated()
, andassert_expected()
. Decoupling the interface from the implementation details like that makes it easier to test and maintain this code.In that spirit, I've also re-written all of the tests to test the functionality of the class rather than the implementation details. There are a variety of test fixtures that create an
NFTestAssert
instance pointing to reference and updated files in a temporary directory. The fixtures are parameterized to test the following situations:script
actual
file was/wasn't updated after theNFTestAssert
was createdactual
globexpect
globactual
andexpect
files do/don't have the same contentThose parameters are matched with appropriate
xfail
marks to confirm that the tests do/don't pass in the expected situations. (Aside: by defaultxfail
hasstrict=False
, meaning that tests that unexpectedly pass do not raise errors. That is bonkers.)Checklist
This PR does NOT contain Protected Health Information (PHI). A repo may need to be deleted if such data is uploaded.
Disclosing PHI is a major problem1 - Even a small leak can be costly2.
This PR does NOT contain germline genetic data3, RNA-Seq, DNA methylation, microbiome or other molecular data4.
.png
, .jpeg
),.pdf
,.RData
,.xlsx
,.doc
,.ppt
, or other output files.To automatically exclude such files using a .gitignore file, see here for example.
I have read the code review guidelines and the code review best practice on GitHub check-list.
I have set up or verified the
main
branch protection rule following the github standards before opening this pull request.The name of the branch is meaningful and well formatted following the standards, using [AD_username (or 5 letters of AD if AD is too long)]-[brief_description_of_branch].
I have added the major changes included in this pull request to the
CHANGELOG.md
under the next release version or unreleased, and updated the date.Footnotes
UCLA Health reaches $7.5m settlement over 2015 breach of 4.5m patient records ↩
The average healthcare data breach costs $2.2 million, despite the majority of breaches releasing fewer than 500 records. ↩
Genetic information is considered PHI.
Forensic assays can identify patients with as few as 21 SNPs ↩
RNA-Seq, DNA methylation, microbiome, or other molecular data can be used to predict genotypes (PHI) and reveal a patient's identity. ↩