1️⃣ pytest's fixtures are functions decorated with "pytest.fixture" decorator
They can return value or produce side effects like creating/removing a database.
They can be located inside conftest.py or inside the test file.
2️⃣ To use the value returned from the fixture function inside a test you need to add a parameter with the same name as the fixture function.
3️⃣ You can run part of the fixture before the test function (before yield) and the part after (after yield).
For example:
* create ES index before test function
* remove ES index after test function
👇
4️⃣ A fixture can accept parameters when using factories
It returns the factory method instead of value.
You can use the factory method inside a test to get a value based on provided parameters
For example, create users with different usernames👇
5️⃣ By default, fixtures run before/after each test - scope='function'.
You can change the scope of the fixture using the *scope* parameter:
* 'module' - before/after all tests in the module
* 'session' - before first and after the last test in the test suite
👇
6️⃣ You can provide multiple different fixtures to the same test by using
* fixture's params argument
* pytest's request
An example 👇
7️⃣ pytest also provides built-in fixtures like:
- tmp_path: pathlib.Path object to a temporary directory unique to each test function
- request: information on the executing test function
- caplog: Control logging and access log entries
- ...
2️⃣ After I finished it I started playing around with Keras and scikit-learn to build a model of my guitar amplifier.
It took 72 hours of recording, 250+ hours of training, and 6 months of experimenting to conclude - ML algorithms like NN won't produce anything useful.
It reads and writes almost like the English language. You need a small amount of code to get a job done. You'll probably rewrite it at least 3 times.
2️⃣ 1st class citizen on cloud platforms
You don't want to deal with physical servers in a startup. You just want to run your app. Python has cloud SDK libraries, it runs on serverless platforms, it's used in ML services, a lot of examples in cloud docs are using Python.