Logs in Flask unittests print out dot after newlineHow to print without newline or space?How to convert Selenese (html) to Python programmatically?Log Unittest output to a text filelogger configuration to log to file and print to stdoutPython: AttributeError: type object 'Ui_Form' has no attribute 'comboBox'Twitter oauth with flask_oauthlib, Failed to generate request tokenHow to read all message from queue using stomp library in Python?Flask with mod_wsgi - Cannot call my modulesTkInter Frame doesn't load if another function is calledCan't debug unittests in Pycharm
The most secure way to handle someone forgetting to verify their account?
Proof that every field is perfect???
How much solution to fill Paterson Universal Tank when developing film?
Does unblocking power bar outlets through short extension cords increase fire risk?
Which failed attempts have there been to find a contradiction in ZFC or ZF?
May I use a railway velocipede on actively-used British railways?
How to tell if JDK is available from within running JVM?
In this iconic lunar orbit rendezvous photo of John Houbolt, why do arrows #5 and #6 point the "wrong" way?
How long were the Apollo astronauts allowed to breathe 100% oxygen at 1 atmosphere continuously?
Authorship dispute on a paper that came out of a final report of a course?
BritRail England Passes compared to return ticket for travel in England
Three Subway Escalators
Is encryption still applied if you ignore the SSL certificate warning for self-signed certs?
How do you send money when you're not sure it's not a scam?
Brute-force the switchboard
How important are the Author's mood and feelings for writing a story?
How did Jayne know when to shoot?
Why didn't Doctor Strange restore Tony Stark after he used the Stones?
Is it possible to invoke "super" with less ambiguous results?
Inscriptio Labyrinthica
What is the name for the average of the largest and the smallest values in a given data set?
How to tell readers that I know my story is factually incorrect?
Should I have one hand on the throttle during engine ignition?
Pauli exclusion principle - black holes
Logs in Flask unittests print out dot after newline
How to print without newline or space?How to convert Selenese (html) to Python programmatically?Log Unittest output to a text filelogger configuration to log to file and print to stdoutPython: AttributeError: type object 'Ui_Form' has no attribute 'comboBox'Twitter oauth with flask_oauthlib, Failed to generate request tokenHow to read all message from queue using stomp library in Python?Flask with mod_wsgi - Cannot call my modulesTkInter Frame doesn't load if another function is calledCan't debug unittests in Pycharm
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a dead simple Flask application :
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return("Hello World!")
if __name__ == '__main__':
app.run()
along with __main__.py
file:
from .core import app
import src.core
app.run()
and i added a test:
from unittest import TestCase
import logging as log
import src.core
class runTests(TestCase):
def setUp(self):
src.core.app.testing = True
self.client = src.core.app.test_client()
def test_hello_world(self):
response = self.client.get("/")
log.warning(f"resp: response.data")
self.assertEqual(b"Hello World!",response.data)
overall tree structure looked like:
➜ apptest tree -L 2
.
├── src
│ ├── core.py
│ ├── __main__.py
│ └── __pycache__
└── tests
├── __pycache__
└── test.py
4 directories, 3 files
➜ apptest
When i run the tests, i got unexpected output:
➜ apptest python -m unittest tests.test
WARNING:root:resp: b'Hello World!'
.
----------------------------------------------------------------------
Ran 1 test in 0.011s
OK
➜ apptest
There is this random dot after newline of the log. I tried out modifying test.py to check it out:
from unittest import TestCase
import logging as log
import src.core
class runTests(TestCase):
def setUp(self):
src.core.app.testing = True
self.client = src.core.app.test_client()
def test_hello_world(self):
response = self.client.get("/")
log.warning(f"resp: response.data")
log.warning("2nd log")
self.assertEqual(b"Hello World!",response.data)
def test_hello_world_2(self):
log.warning("3rd log")
log.warning("4th log")
self.assertEqual("Hello World!",self.teststring)
And the output:
➜ apptest python -m unittest tests.test
WARNING:root:resp: b'Hello World!'
WARNING:root:2nd log
.WARNING:root:3rd log
WARNING:root:4th log
.
----------------------------------------------------------------------
Ran 2 tests in 0.011s
OK
➜ apptest
And it appears that last log of every function is printing n.
instead of just n
, if my thinking is right.
What is causing this, and how to get rid of it?
python unit-testing logging
add a comment |
I have a dead simple Flask application :
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return("Hello World!")
if __name__ == '__main__':
app.run()
along with __main__.py
file:
from .core import app
import src.core
app.run()
and i added a test:
from unittest import TestCase
import logging as log
import src.core
class runTests(TestCase):
def setUp(self):
src.core.app.testing = True
self.client = src.core.app.test_client()
def test_hello_world(self):
response = self.client.get("/")
log.warning(f"resp: response.data")
self.assertEqual(b"Hello World!",response.data)
overall tree structure looked like:
➜ apptest tree -L 2
.
├── src
│ ├── core.py
│ ├── __main__.py
│ └── __pycache__
└── tests
├── __pycache__
└── test.py
4 directories, 3 files
➜ apptest
When i run the tests, i got unexpected output:
➜ apptest python -m unittest tests.test
WARNING:root:resp: b'Hello World!'
.
----------------------------------------------------------------------
Ran 1 test in 0.011s
OK
➜ apptest
There is this random dot after newline of the log. I tried out modifying test.py to check it out:
from unittest import TestCase
import logging as log
import src.core
class runTests(TestCase):
def setUp(self):
src.core.app.testing = True
self.client = src.core.app.test_client()
def test_hello_world(self):
response = self.client.get("/")
log.warning(f"resp: response.data")
log.warning("2nd log")
self.assertEqual(b"Hello World!",response.data)
def test_hello_world_2(self):
log.warning("3rd log")
log.warning("4th log")
self.assertEqual("Hello World!",self.teststring)
And the output:
➜ apptest python -m unittest tests.test
WARNING:root:resp: b'Hello World!'
WARNING:root:2nd log
.WARNING:root:3rd log
WARNING:root:4th log
.
----------------------------------------------------------------------
Ran 2 tests in 0.011s
OK
➜ apptest
And it appears that last log of every function is printing n.
instead of just n
, if my thinking is right.
What is causing this, and how to get rid of it?
python unit-testing logging
Those dots represent a test that has run. The more tests the more dots. Usually they would be on the same line but It looks like they are getting pushed around by your logging output.
– SuperShoot
Mar 26 at 11:03
What could be the reason for that? Logging configuration?
– w1kl4s
Mar 26 at 12:34
add a comment |
I have a dead simple Flask application :
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return("Hello World!")
if __name__ == '__main__':
app.run()
along with __main__.py
file:
from .core import app
import src.core
app.run()
and i added a test:
from unittest import TestCase
import logging as log
import src.core
class runTests(TestCase):
def setUp(self):
src.core.app.testing = True
self.client = src.core.app.test_client()
def test_hello_world(self):
response = self.client.get("/")
log.warning(f"resp: response.data")
self.assertEqual(b"Hello World!",response.data)
overall tree structure looked like:
➜ apptest tree -L 2
.
├── src
│ ├── core.py
│ ├── __main__.py
│ └── __pycache__
└── tests
├── __pycache__
└── test.py
4 directories, 3 files
➜ apptest
When i run the tests, i got unexpected output:
➜ apptest python -m unittest tests.test
WARNING:root:resp: b'Hello World!'
.
----------------------------------------------------------------------
Ran 1 test in 0.011s
OK
➜ apptest
There is this random dot after newline of the log. I tried out modifying test.py to check it out:
from unittest import TestCase
import logging as log
import src.core
class runTests(TestCase):
def setUp(self):
src.core.app.testing = True
self.client = src.core.app.test_client()
def test_hello_world(self):
response = self.client.get("/")
log.warning(f"resp: response.data")
log.warning("2nd log")
self.assertEqual(b"Hello World!",response.data)
def test_hello_world_2(self):
log.warning("3rd log")
log.warning("4th log")
self.assertEqual("Hello World!",self.teststring)
And the output:
➜ apptest python -m unittest tests.test
WARNING:root:resp: b'Hello World!'
WARNING:root:2nd log
.WARNING:root:3rd log
WARNING:root:4th log
.
----------------------------------------------------------------------
Ran 2 tests in 0.011s
OK
➜ apptest
And it appears that last log of every function is printing n.
instead of just n
, if my thinking is right.
What is causing this, and how to get rid of it?
python unit-testing logging
I have a dead simple Flask application :
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return("Hello World!")
if __name__ == '__main__':
app.run()
along with __main__.py
file:
from .core import app
import src.core
app.run()
and i added a test:
from unittest import TestCase
import logging as log
import src.core
class runTests(TestCase):
def setUp(self):
src.core.app.testing = True
self.client = src.core.app.test_client()
def test_hello_world(self):
response = self.client.get("/")
log.warning(f"resp: response.data")
self.assertEqual(b"Hello World!",response.data)
overall tree structure looked like:
➜ apptest tree -L 2
.
├── src
│ ├── core.py
│ ├── __main__.py
│ └── __pycache__
└── tests
├── __pycache__
└── test.py
4 directories, 3 files
➜ apptest
When i run the tests, i got unexpected output:
➜ apptest python -m unittest tests.test
WARNING:root:resp: b'Hello World!'
.
----------------------------------------------------------------------
Ran 1 test in 0.011s
OK
➜ apptest
There is this random dot after newline of the log. I tried out modifying test.py to check it out:
from unittest import TestCase
import logging as log
import src.core
class runTests(TestCase):
def setUp(self):
src.core.app.testing = True
self.client = src.core.app.test_client()
def test_hello_world(self):
response = self.client.get("/")
log.warning(f"resp: response.data")
log.warning("2nd log")
self.assertEqual(b"Hello World!",response.data)
def test_hello_world_2(self):
log.warning("3rd log")
log.warning("4th log")
self.assertEqual("Hello World!",self.teststring)
And the output:
➜ apptest python -m unittest tests.test
WARNING:root:resp: b'Hello World!'
WARNING:root:2nd log
.WARNING:root:3rd log
WARNING:root:4th log
.
----------------------------------------------------------------------
Ran 2 tests in 0.011s
OK
➜ apptest
And it appears that last log of every function is printing n.
instead of just n
, if my thinking is right.
What is causing this, and how to get rid of it?
python unit-testing logging
python unit-testing logging
asked Mar 26 at 10:50
w1kl4sw1kl4s
521 silver badge7 bronze badges
521 silver badge7 bronze badges
Those dots represent a test that has run. The more tests the more dots. Usually they would be on the same line but It looks like they are getting pushed around by your logging output.
– SuperShoot
Mar 26 at 11:03
What could be the reason for that? Logging configuration?
– w1kl4s
Mar 26 at 12:34
add a comment |
Those dots represent a test that has run. The more tests the more dots. Usually they would be on the same line but It looks like they are getting pushed around by your logging output.
– SuperShoot
Mar 26 at 11:03
What could be the reason for that? Logging configuration?
– w1kl4s
Mar 26 at 12:34
Those dots represent a test that has run. The more tests the more dots. Usually they would be on the same line but It looks like they are getting pushed around by your logging output.
– SuperShoot
Mar 26 at 11:03
Those dots represent a test that has run. The more tests the more dots. Usually they would be on the same line but It looks like they are getting pushed around by your logging output.
– SuperShoot
Mar 26 at 11:03
What could be the reason for that? Logging configuration?
– w1kl4s
Mar 26 at 12:34
What could be the reason for that? Logging configuration?
– w1kl4s
Mar 26 at 12:34
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55355324%2flogs-in-flask-unittests-print-out-dot-after-newline%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55355324%2flogs-in-flask-unittests-print-out-dot-after-newline%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Those dots represent a test that has run. The more tests the more dots. Usually they would be on the same line but It looks like they are getting pushed around by your logging output.
– SuperShoot
Mar 26 at 11:03
What could be the reason for that? Logging configuration?
– w1kl4s
Mar 26 at 12:34