pytest.org (@pytestdotorg )

pytest.org

Bio a full-featured Python testing tool to help you write better programs. /tweets by @pfctdayelise @hpk42 @hackebrot @the_compiler
Tweets 1,6K
Followers 4,8K
Following 60
Account created 05-02-2015 21:03:07
ID 3020468877

Android : Every time I go down the Python/Pytest import-my-code-modules rabbit-hole I want to hurl my laptop into the sun.

There are so many contradictory opinions on how to do this the right way.

There are precious few examples of a solid unit-testing directory setup for AWS Lambda. :(

Android : #pytest/Visual Studio Code tip: Im not very fond of the built-in test runner so I cobbled together two quick shortcuts:

(1) run all tests in current file
(2) run highlighted test function (by name)

No more pytest -k test_func_name for me

Android : New screencast: adding a function and tests to siuba

I walk through working on #python packages, and unit tests with pytest. In this case, I stub out a pivot_longer function along w/ some of the unit tests from the library tidyr!

youtu.be/N7Sm4qdm_rs #rstats

Android : Flags que deberías usar con pytest y no estás usando:

--ff --nf --random-order-bucket=module

Android : If you were tasked to write software to test some hardware, would you use a testing framework like #pytest or #mocha? Or would you write a regular application with that sole purpose in mind?

I'm sure the answer is obvious, maybe I'm overthinking this. Both approaches feel weird.

Android : So I found a bug in an algorithm by... pytest-benchmark-ing it? Do people often write automated profiling tests besides the usual unit ones?

Android : On the latest Building SaaS with #Python and #Django, I switched the test runner on my Django app to use #pytest. We walked through all the configuration and I showed off the benefits that come from using pytest. The recording and notes are now available. mattlayman.com/building-saas/…

Android : Six Principles of Readable Tests

by David Seddon

🎧Podcast: testandcode.com/112 (@TestAndCode)
📓Slides: docs.google.com/presentation/d…

1. Profit from the work of others
2. Put naming to work
3. Show only what matters
4. DRY
5. Arrange, act, assert
6. Aim high

#Python #Testing

Android : Neat pytest trick: the `request` fixture lets you retrieve data about the current test.

import pytest

pytestm.fixture(autouse=True)
def _print_test_name(request):
test_name = request.node.nodeid
print(f"Hello from {test_name}")

def test_foo():
assert True

Android : I'll be streaming on #Twitch tonight at 9pm ET. I'm planning to convert my #Django app to use #pytest as the test runner. Feel free to join in and see how the conversion goes! twitch.tv/mblayman

Android : (Of course all of this is based on my personal experience, your mileage may vary, some of you don’t write bugs but I do 😭)

I test my code because I don’t enjoy fixing it as soon as asap

Android : if you're using pytest.org it takes more than 20s try this

pytest --durations=10

it will show you the slowest tests so you can go in and make them faster