Conversation
|
Thanks for the effort and the pull request! I am not entirely sure if I understand this correctly. You're testing and mocking against
I have considered to write an in-memory file-system for proper tests, e.g. similar to memfs or kungfuse, by e.g. "upgrading" loggedfs-python. This would allow tests against a "real" file system while being able to inspect the file system's contents and feedback while testing. It's a bit time consuming, to be honest. |
|
You are right. These tests doesn't depend on any "actual FS" implementation. This is, in my opinion, good because we want to be testing libfuse binding for python (passing stuff from libfuse to python code and from py to libfuse). We don't want to be testing dummy FS implementation. Of course dummy implementation is unavoidable - here I implemented very simple FS using mocks. With more complex test more complex implementation(s) may come. The point is that the simpler the FS implementation the smaller the chance for covering (hiding) potential refuse bugs with FS implementation. What the tests are telling me? Any test that loads refuse tests the following properties:
Six tests I provided test the following properties:
|
|
I got somewhat familiar with travis+tox+pytest setup when updating CI configuration and test suite in ipfs-api-mount. I can port it here if there is some chance it will be merged eventually. |
|
It's an improvement for sure so there no reason to not merge it. I need to find some time to look through it, though. |
|
I've updated tests to be pytest-style. Also I configured tox. I've got configuration for flake ready, but that will come in another PR to keep this one in managable size |
This is proposal for a basic test infrastructure. This hasn't been consulted with anyone prior this PR. Idea is to test behaviour of mounted filesystem using
osmodule. At the same time implementation interface is tested using mocks. All of this is done in single python process, using multiple threads. Mountpoints are obtained viatempfilemodule.Python-level mounting code is extracted and generalised from ipfs-api-mount.
There are few not-so-ideal solutions in this PR and things not sorted out yet:
/proc/mountsfile. AFAIK this is linux-specific. Good part is that it can be easily substituted.python setup.py test, but this seems to be deprecated. Deprecation message mentionstoxas a recommended solution.Let me know if this is a desired approach to testing refuse. If it is then I can put some work in it - up to this point it's a copy-paste effort. In my opinion after resolving points 3. and 4. it'll be ready for merging.
Related issues #13, fusepy#80