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.

Call to global_init() required to run any test individually

See original GitHub issue

Each specific rest requires global_init() to be ran before it can be run. The test_can_call_init_with_good_path() test does this, and that appears to enable all other tests to run.

def test_can_call_init_with_good_path():
    fc.global_init(folder, cache_init=False)

If you run various tests individually, they error out because global_init is not called. I am working on a fix for the fastapi-jinja library that uses a pytest fixture to make this work. I am basically creating a fixture that is like this:

@pytest.fixture
def call_global_init():
    here = os.path.dirname(__file__)
    folder = os.path.join(here, "templates")
    fc.global_init(folder, cache_init=False)

The fixture could then be added to any test that requires global init to be called. It should work, but I want to verify.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mikeckennedycommented, May 8, 2021

@fferegrino Yes, that’d be great! I’ll definitely take a PR on it if you’re game.

0reactions
mikeckennedycommented, May 8, 2021

This is fixed with @fferegrino’s latest PR I just merged. Thank you both.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Imagining a thread-safe curl_global_init - Daniel Stenberg
There's a counter counting calls to curl_global_init() so that the corresponding number of calls to curl_global_cleanup() is required before ...
Read more >
lab04 - Odds and primes: Fun with arrays and makefiles -
This lab must be completed individually (and not with a pair partner). ... Then use an ls command, and you should see new...
Read more >
Global test initialize method for MSTest - Stack Overflow
Create a public static method, decorated with the AssemblyInitialize attribute. The test framework will call this Setup method once per test run:
Read more >
Initialize global data separately and run_once in WSGI app init ...
We have discovered that if an exception is raised at any point during the running of the init_application WSGI script in an apache/mod_wsgi...
Read more >
dejagnu.pdf - GNU.org
the GNU Free Documentation License, Version 1.3 or any later version ... Running tests requires two things: the testing framework and the ...
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