Skip to content
Advertisement

Tag: testing

How to run script as pytest test

Suppose I have a test expressed as a simple script with assert-statements (see background for why), e.g How would I include this script in my pytest test suite — in a nice way? I have tried two working but less-than-nice approaches: One approach is to name the script like a test, but this makes the whole pytest discovery fail when

What is the difference between `assert_frame_equal` and `equals`

I’m curious to find the difference between assert_frame_equal and equal. Both are for checking the equality of two data. It applies for assert_series_equal and assert_index_equal. So what is the difference between equals and testing functions? So far I found was testing functions gives little more flexibility to compare the values, like check_dtpye options etc., and differs from returning values Is

How to test a Django on_commit hook without clearing the database?

The on_commit function has been added to Django 1.9 to be able to trigger an action (e.g. a Celery task) after the current transaction has committed. They mention later in the docs that one should use TransactionTestCase to test features that rely on that function. However, unlike TestCase (which uses transactions and rolls them back), TransactionTestCase empties the whole database

Artificially creating memory usage in Python

I’m trying to create a pure memory intensive script in Python for testing purposes but every script that I try also increases my cpu. I’ve read this post and I also tried, among others: in order to copy an array to another array but once again I had cpu variations as well. UPDATED So, how can I cause a standard

Advertisement