question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Monitor usage resulting in repeated printing

See original GitHub issue

Describe the bug I use captured print statements to build test reports. In using pytest-monitor, I notice that its usage produces the effect of repeating these statements.

To Reproduce Steps to reproduce the behavior:

  1. Create a simple hello-world pytest function.
  2. Run the test with the -s flag to allow printing to console, observe multiple statements.
  3. Run again but include -p no:monitor, observe single statement.

Expected behavior The printing of a single statement.

Screenshots image

Desktop (please complete the following information):

  • OS: Pop!_OS 20.04LTS
  • Python 3.7.8
  • Pytest 6.0.2
  • Other plugins: metadata, html

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
js-dieucommented, Nov 8, 2020

After some investigations, I think the problem is related to memory_profiler. The following example illustrates the problem you are experiencing:

import memory_profiler

def foo():
   print('Hello World')

if __name__ == '__main__':
   print(memory_profiler.memory_usage((foo, ()), max_usage=True, retval=True))

This prints the following on my machine:

Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
(25.5625, None)

If I remove the memory profiling part from the plugin, the output is as expected. I’ll ask for some support to memory_profiler.

Edit: https://github.com/pythonprofilers/memory_profiler/issues/298

2reactions
js-dieucommented, Oct 12, 2020

Hello @csheaff

Thanks for reporting. It is a bit weird to me as I do not play at all with capture fixtures nor the way pytest handles logs and prints. I might be hard to analyze and debug but I’ll try to have a look this week prior to the upcoming release of pytest-monitor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Printer keeps printing the same page automatically
Method 1: Run the Printer troubleshooter and check if it helps. Follow the steps to run the troubleshooter: a. Press ...
Read more >
13 Common Printer Problems and How to Fix Them
These parts have also been known to cause a jams after repeated use and eventually may need to be replaced.
Read more >
Printer Turns Off Unexpectedly or Repeatedly - HP Support
The printer suddenly turns off without warning. A print, copy, scan, or fax job fails because power might be low or the printer...
Read more >
Solve printing problems on Mac - Apple Support (HK)
Choose Apple menu > System Settings, then click Printers & Scanners in the sidebar. (You may have to scroll down.) Click the printer...
Read more >
Everything You Need To Know About Screen Printing by Inkwell
Any designs that are created with the screen printing method can use multiple shades of ink. However, with a multi-colored design, it is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found