site icon indicating copy to clipboard operation
site copied to clipboard

Switch out pyfakefs to using test files in the test directory

Open jchristgit opened this issue 3 years ago • 3 comments

This would also allow running docker-compose exec web python manage.py test, since pyfakefs is only installed for development.

Alternatively, we could add a separate container like docker-compose run tests.

"The best code is not having any code" - @lemonsaurus

jchristgit avatar Feb 23 '22 21:02 jchristgit

Just to make sure I understand your proposal, you'd like to simply write actual files to disk rather than faking the filesystem in tests? Should the tests also clean up those files in the teardown?

An alternative could be using a temporary directory instead of the tests folder. Ideally, it would get cleaned up between tests to avoid violating the test isolation principle.

Yet another alternative could be using a container for development that does include (some of) the development dependencies, although that would mean the development container is fundamentally different from the one built for production, which is less than ideal as well.

SebastiaanZ avatar Mar 06 '22 20:03 SebastiaanZ

Just to make sure I understand your proposal, you'd like to simply write actual files to disk rather than faking the filesystem in tests?

Yes

Should the tests also clean up those files in the teardown?

No, the files would be present beforehand. I'm 99% sure we don't have anything that depends on "what happens if I move this file there" or "delete this file here and there", the idea is mostly to create a resource layout

jchristgit avatar Mar 06 '22 21:03 jchristgit

Alright, they are just static test resources in that case. Cool, I'll have a stab at it.

SebastiaanZ avatar Mar 08 '22 06:03 SebastiaanZ

Hi @SebastiaanZ, did you have some time to check out this issue or do you mind if I snag it from you?

jchristgit avatar Nov 19 '22 12:11 jchristgit