jcsambangi / bme590final_backend

Back end functionality for the HIE sensor management tool.
MIT License
1 stars 0 forks source link

Testing DASHR interaction functions #26

Closed jcsambangi closed 5 years ago

jcsambangi commented 5 years ago

@mlp6 I have a function that reads certain data from a file when passed the file's path. It is called within a parent function that first trawls a directory to find that file's path (based on a certain naming scheme). I am attempting to test these functions in the code below, which are passed the path of a directory fixture and the path of a file fixture I put inside the directory fixture, respectively: https://github.com/jcsambangi/bme590final_backend/blob/df1ca3dad6167caed0d5a2776f336be3647dcd30/test_DASHR.py#L1-L10 The second test passes successfully, but the first always fails. I looked at the absolute paths being passed to both tests and discovered that the second test sees the path of the file fixture as being inside a folder named what I named it plus "1" on the end, while the first test sees the path of the directory fixture as being what I named it plus "0" on the end. The code where I created the fixtures: https://github.com/jcsambangi/bme590final_backend/blob/0bd59a9ef24ae0f91f49b1a03f26e4d93480ea0a/conftest.py#L4-L24 So it almost seems like the reason the first test is failing is because it genuinely can't find the file inside the folder path it's being passed, because the file is actually inside a different folder (evidenced by the second test passing for a different folder path). But I explicitly joined the file to the directory fixture I created: https://github.com/jcsambangi/bme590final_backend/blob/0bd59a9ef24ae0f91f49b1a03f26e4d93480ea0a/conftest.py#L18 Do you have any idea why this might be happening? (Apologies that I can't link you to a Travis build as we are still working out our database testing.)