Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8762119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:27:03+00:00 2026-06-13T15:27:03+00:00

How can a user of a library run his own initialization code (setting debug

  • 0

How can a user of a library run his own initialization code (setting debug levels of loggers for example) before running tests supplied with the library? Python’s unittest module is used as a testrunner.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:27:04+00:00Added an answer on June 13, 2026 at 3:27 pm

    You can try using pytest to run the unittests. If that works (many unittest based test suites work), then you can create a little module, for example “mymod.py”, defining a pytest configuration hook:

    # content of mymod.py
    def pytest_configure():
        import logging
        logging.getLogger().setLevel(logging.WARN)
    

    If you now execute py.test like this:

    $ py.test -p mymmod --pyargs mylib
    

    Then the “mylib” package will be searched for tests and ahead of running them the logging level is modified. The “-p” option specifies a plugin to load and the “–pyargs” tells pytest to try importing the arguments first, instead of treating them as directory or file names (the default).

    For more info: http://pytest.org and http://pytest.org/latest/unittest.html

    HTH,
    holger

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a library search engine where a user can search based on various
Can you please tell me if there is any library/API to detect if user
Can any user run inline assembly for current linux kernel or does that require
I've seen some websites that can run code from the browser, and the code
Can a user install my application from iTunesStore if he is having iPhone OS
Can I user mono's AOT feature to natively pre-compile .NET DLLs (and or EXEs)
A user can upload a picture on my site at which point jQuery inserts
A user can post 4 times at most within a day. The difficulty is
A user can import data into our website from a file. The data normally
User can switch active application by Alt+Tab or by clicking on their icons in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.