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.

`RuntimeError` when running tests locally

See original GitHub issue

I followed the README and did:

# inside a fresh Python 3.6 virtualenv
$ pip install -e .[tests]
$ pytest

It hangs right here:

$ pytest
=================================================== test session starts ====================================================
platform darwin -- Python 3.6.1, pytest-3.4.1, py-1.5.2, pluggy-0.6.0
rootdir: /Users/eric/src/daphne, inifile: setup.cfg
plugins: asyncio-0.8.0, hypothesis-3.45.3
collected 46 items

tests/test_cli.py .........                                                                                          [ 19%]
tests/test_http_request.py

Then slowly the failing tests roll in

self = <daphne.testing.DaphneTestingInstance object at 0x10834d0b8>

    def __enter__(self):
        # Clear result storage
        TestApplication.delete_setup()
        TestApplication.delete_result()
        # Option Daphne features
        kwargs = {}
        # Optionally enable X-Forwarded-For support.
        if self.xff:
            kwargs["proxy_forwarded_address_header"] = "X-Forwarded-For"
            kwargs["proxy_forwarded_port_header"] = "X-Forwarded-Port"
        if self.http_timeout:
            kwargs["http_timeout"] = self.http_timeout
        # Start up process
        self.process = DaphneProcess(
            host=self.host,
            application=TestApplication,
            kwargs=kwargs,
            setup=self.process_setup,
            teardown=self.process_teardown,
        )
        self.process.start()
        # Wait for the port
        if self.process.ready.wait(self.startup_timeout):
            self.port = self.process.port.value
            return self
        else:
            if self.process.errors.empty():
>               raise RuntimeError("Daphne did not start up, no error caught")
E               RuntimeError: Daphne did not start up, no error caught

daphne/testing.py:57: RuntimeError
========================================== 25 failed, 21 passed in 100.29 seconds ==========================================

I think I am doing most everything right. I looked at how travis was running tests so I went further and did:

$ pip install twisted isort unify flake8 -e .[tests]

Same result, though. Tests are passing on Travis so I must be doing something wrong… again hopefully this issue just helps the next person figure out the simple thing they are missing 😃

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ckcollabcommented, Jul 8, 2020

thanks @carltongibson 😃

0reactions
carltongibsoncommented, Jul 8, 2020

This should have been resolved in #247.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Runtime Error on Run Tests : r/learnjava - Reddit
Details: Caused by: Failed to run tests for exercise at c:\Users\Peter\AppData\Local\tmc\vscode\mooc-java-programming-i\part03-Part03_15.
Read more >
Unit tests are not working locally (go 1.17.5) #2567 - GitHub
Reproducing this issue. It was reported on the channel that someone was not able to run the tests. the tests are called in...
Read more >
"RuntimeError: working outside of application context" when ...
I'm trying to migrate to py.test for the ease of use and auto-discovery of tests. When I run my tests with unittest, the...
Read more >
system error? I pass the test case locally but not when submit
I pass the test case locally but not when submit. I ran the same test case using run code and it passes but...
Read more >
Runtime error on cf server but code runs fine locally. What ...
My code gave a runtime error for array of size 1 on the system tests. But the exact same code is working for...
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