mardi 25 avril 2017

Pytest - Good practice for reading Excel & SQL

I have a python application that data mines a number of server folders to extract Excel files that contain a specific cell. From these Excel files, a SQL database is populated each month with the data from the Excel files, the files are updated on a regular basis and the database contains a monthly snapshot.

After the monthly snapshot, a graph is printed for each Excel file, using matplotlib, showing the trends over the past 12 months.

The application works fine at the moment but I would like to add some tests using pytest.

Now, is it best practice to create a sample Excel file and SQL database to run the tests against as this will provide me with some way of checking that the test results are run against consistent data, or is it typical to run tests against the live data?

Secondly, how do I test pytest to use sample data when running a test, leaving my application to use the real data the rest of the time?

Aucun commentaire:

Enregistrer un commentaire