Giter Site home page Giter Site logo

Comments (19)

niosus avatar niosus commented on May 27, 2024

oh, sorry, opened in a wrong repo. I should stop coding late. Thanks for moving it here!

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

It should be possible by exposing the stream object to users.

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

6708fc0 added a logger, you could use logger in your test*.py as follows

logger = logging.getLogger('UnitTesting')
logger.setLevel(logging.DEBUG)

class TestUnitTesting(TestCase):
     def test_something(self):
          logger.debug("hello")

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

looks like ST2 does not like it...

edit, 779f357 should fix it

from unittesting.

niosus avatar niosus commented on May 27, 2024

Thanks @randy3k that was fast! Are you planning to make it part of the next version in the Package Manager? Or should I just clone this repo?

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

It is released. You should be able to upgrade it via Package Control.

from unittesting.

niosus avatar niosus commented on May 27, 2024

I guess I will have to wait some time till it becomes available through Package Control. I believe there is some lag till it is ready for the public. I have used PackageResourceViewer to verify there is still no logger present on my local machine. By the way, is there an easy way to check version of your plugin?

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

PC has updated UnitTesting, the latest version is 0.5.9.

You can use Package Control: List Packages to check package version.

from unittesting.

niosus avatar niosus commented on May 27, 2024

Ah, you're totally right! Thanks for your patience :)

Logging something in tests works now. Do you think it is possible to also output something that is being logged from the package under test?

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

You can use the same logger in your package.

from unittesting.

niosus avatar niosus commented on May 27, 2024

Yes, I see this option, but my plugin has already nicely configured loggers with their specific names for each module, so in the ideal case I would still like to see them with their specific names. However, if you estimate that this is hard to do - it is not too crucial to me. Just a "nice to have" feature. Thanks anyway!

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

You can configure your loggers such that all messages would be forward to the UnitTesting logger.

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

@niosus

The logger.getLogger("UnitTesting") is now deprecated. A new settings capture_console in unittesting.json will redirect the sublime console to the output stream. It is still new, use with care. :)

from unittesting.

niosus avatar niosus commented on May 27, 2024

Thanks! This sounds pretty awesome!

from unittesting.

niosus avatar niosus commented on May 27, 2024

I think the setting is wrong. It works if I use caputre_console instead of capture_console.

Also, it doesn't seem to capture the outputs of logging. At least in my case. It prints the lines printed with print(...)

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

The setting name has been fixed. It seems that logging is still using the original stdout even the the current stdout has been directed to the output stream.

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

I have an idea how to fix it. I am out now, will fix when I get back home.

from unittesting.

randy3k avatar randy3k commented on May 27, 2024

fix in e3a3235.

from unittesting.

niosus avatar niosus commented on May 27, 2024

Perfect! Now it works exactly as I was dreaming 👍 Great job!

from unittesting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.