Skip to content

Conversation

@ianthomas23
Copy link
Collaborator

This is a proof of concept of an abstract test harness in fsspec that can be used to define, in a fairly generic way, the set of tests that every implementation should pass. The tests only need to be written once in fsspec and each of the implementations can inherit and run these tests with minimal code.

There are just 3 tests included so far, one each of cp, get and put, to test remote to remote, remote to local and local to remote transfers. I have s3fs and gcsfs code to work with this, and all these run and pass on my local machine.

The tests are defined in fspec/test/abstract, one class per fsspec function to be tested and each class contains one (it will be more!) test. There is an AbstractFixtures class that provides local filesystem functionality.

There are two implementations, local and memory. The code to inherit and hence to run the tests is really simple, just a class that inherits from each of the Abstract test classes and also from a mixin class that derives from AbstractFixtures. The mixin class, e.g. MemoryFixtures, provides the filesystem to be used by the tests and is simple for local and memory but will be much more complicated for s3fs and gcsfs for example. The test class inheritance and use of mixin for fixtures wasn't the first approach I tried but it works well with the pytest approach of dynamically finding tests and fixtures.

At this stage the plan is just to run it through CI to see what fails, I expect Windows tests will produce some problems.

@martindurant martindurant merged commit d6e569d into master Mar 17, 2023
@martindurant martindurant deleted the abstract_test_harness branch March 17, 2023 13:30
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