Skip to content

Latest commit

 

History

History
78 lines (60 loc) · 3.93 KB

ReadMe.md

File metadata and controls

78 lines (60 loc) · 3.93 KB

fileTestSuite.pyUnlicensed work

wheel (GHA via nightly.link) GitHub Actions Libraries.io Status Code style: antiflash

We have moved to https://codeberg.org/fileTestSuite/fileTestSuite.py , grab new versions there.

Under the disguise of "better security" Micro$oft-owned GitHub has discriminated users of 1FA passwords while having commercial interest in success and wide adoption of FIDO 1FA specifications and Windows Hello implementation which it promotes as a replacement for passwords. It will result in dire consequencies and is competely inacceptable, read why.

If you don't want to participate in harming yourself, it is recommended to follow the lead and migrate somewhere away of GitHub and Micro$oft. Here is the list of alternatives and rationales to do it. If they delete the discussion, there are certain well-known places where you can get a copy of it. Read why you should also leave GitHub.


An implementation of fileTestSuite spec for Python.

Authoring

fileTestSuiteTool --help

init

Creates a boilerplate of meta.json.

convert

  1. Create a meta.json in a dir.
  2. fileTestSuiteTool convert meta.json to convert into the binary representation
  3. fileTestSuiteTool convert meta.ftsmeta to convert the binary representation back into JSON.

Testing

Via withFTS decorator

  1. Download a suite of test files. It can be a git submodule.
from fileTestSuite.unittest import withFTS
  1. Get path of the directory of the test suite:
thisDir = Path(__file__).resolve().absolute().parent
thisDir = thisDir / "testDataset"
  1. Create a test
class Tests(unittest.TestCase):
	@withFTS(thisDir / "testDataset")  # the decorator, that must be within a `TestCase`
	def testProcessorImpl(self, challFile: Path, respFile: Path, paramsDict: typing.Optional[dict]=None) -> None:  # the signature must be this one!
		self._testChallengeResponsePair(challFile=challFile.read_bytes(), respFile=respFile.read_bytes(), paramsDict=paramsDict)  # your function

Pros:

  • each file corresponds to a test
  • it nicely interoperates with pytest

Cons:

  • tests are loaded at class construction time.

Via a subTest

from fileTestSuite.unittest import FileTestSuiteTestCaseMixin
  1. Create a test
class Tests(unittest.TestCase, FileTestSuiteTestCaseMixin):
	@property
	def fileTestSuiteDir(self) -> Path:
		return thisDir / "testDataset"

	def _testProcessorImpl(self, challFile: Path, respFile: Path, paramsDict: typing.Optional[dict]=None) -> None:  # the signature must be this one! Note the underscore.
		self._testChallengeResponsePair(challFile=challFile.read_bytes(), respFile=respFile.read_bytes(), paramsDict=paramsDict)  # your function

Pros, cons: the inversion of ones of withFTS.