Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jan 31 2019 22:49
    RonnyPfannschmidt commented #4702
  • Jan 31 2019 22:25
    nicoddemus opened #4703
  • Jan 31 2019 22:12
    nicoddemus commented #4702
  • Jan 31 2019 21:58
    nicoddemus commented #4701
  • Jan 31 2019 21:22
    RonnyPfannschmidt commented #4701
  • Jan 31 2019 21:20
    RonnyPfannschmidt labeled #4702
  • Jan 31 2019 21:20
    RonnyPfannschmidt labeled #4702
  • Jan 31 2019 21:20
    RonnyPfannschmidt labeled #4702
  • Jan 31 2019 21:20
    RonnyPfannschmidt labeled #4702
  • Jan 31 2019 21:20
    RonnyPfannschmidt labeled #4702
  • Jan 31 2019 21:19
    RonnyPfannschmidt commented #4702
  • Jan 31 2019 21:05
    wimglenn commented #4700
  • Jan 31 2019 20:47
    wimglenn commented #4699
  • Jan 31 2019 20:46
    astraw38 opened #4702
  • Jan 31 2019 20:44
    nicoddemus commented #4701
  • Jan 31 2019 19:45
    davidak commented #4701
  • Jan 31 2019 19:10

    nicoddemus on features

    Preparing release version 4.2.0 Merge pull request #4696 from nā€¦ Merge pull request #4697 from nā€¦ (compare)

  • Jan 31 2019 19:10
    nicoddemus closed #4697
  • Jan 31 2019 19:10
    nicoddemus labeled #4701
  • Jan 31 2019 19:10
    nicoddemus labeled #4701
lord_fomo
@goodboy:matrix.org
[m]
kk
that's good
šŸ„ā€ā™‚ļø
yeah pluggy is a pretty minimal system
it's basically just a fan-out function call with variable "consumers" of that call
David Tucker
@tucked:matrix.org
[m]
ya... it's pretty great šŸ˜Ž
lord_fomo
@goodboy:matrix.org
[m]
šŸ‘ļø
aight i'm onto bourbon
gl with your thing
David Tucker
@tucked:matrix.org
[m]
thanks!
lord_fomo
@goodboy:matrix.org
[m]
David Tucker: oh and btw if you end up getting something working with class / static methods please do put up a PR for both minimal tests and docs
i see no reason not to make this behavior up front since we are trying to emphasize Callable duck-typing, not specific types in python
David Tucker
@tucked:matrix.org
[m]
right on... probably won't need that route, but will do if that changes
David Tucker
@tucked:matrix.org
[m]

we've got a package that is a pytest plugin, but also includes tests. right now, we run those tests by defining a custom entry_point which just calls

sys.exit(pytest.main([resource_filename("mypkg", "tests")] + argv))

(it doesn't use --pyargs because of https://github.com/pytest-dev/pytest/issues/1596)
the problem is that those tests show up as ../usr/local/lib/python2.7/site-packages/mypkg/tests/test_whatever::test_whatever_foo (2.7 i know, know... working on it)

would it be sane to have our entry_point do this instead?

os.chdir(resource_filename("mypkg", "tests"))
sys.exit(pytest.main(argv))
tucked
@tucked:matrix.org
[m]
hmmm... actually i think we can get around that issue by registering as a plugin in setup.py instead of relying on conftest.py being discovered.
next Q tho: can node IDs be used with --pyargs?
David Tucker
@tucked:matrix.org
[m]
heh... they are different! pytest --pyargs mypkg.tests.test_whatever::test_whatever_foo
Ronny
@ronnypfannschmidt:matrix.org
[m]
Py args and node ids don't play well
dtux
@dmtucker:matrix.org
[m]
interesting... well, it beats our previous solution (hard code the installed test dir and rely on -k instead of node IDs), but it would be cooler if the same/standard node IDs could be used
Ronny
@ronnypfannschmidt:matrix.org
[m]
the concept thats necessary to do this better is "test roots" which may be on pythonpath
Sorin Sbarnea
@ssbarnea
thanks for changing pluggy<2, now I only need to wait for the next release.
Henry Schreiner
@henryiii
Is it hard to have an optional, default off test (vs. optional, default on, easy with markers)? The only plugin I can find for it has been untouched for 2 years and a bit broken.
Ronny
@ronnypfannschmidt:matrix.org
[m]
@henryiii the slow test examples show
Ronny
@ronnypfannschmidt:matrix.org
[m]
:point_up: Edit: @henryiii the slow test examples show
guilledk
@guilledk:matrix.org
[m]
hey guys, im writing a plugin and i need to display some output from a hook
im doing it from a fixture using this code:
terminal_reporter = request.config.pluginmanager.get_plugin('terminalreporter')
capture_manager = request.config.pluginmanager.get_plugin('capturemanager')
with capture_manager.global_and_fixture_disabled():
    terminal_reporter.ensure_newline()
    terminal_reporter.write("TEST SESSION DONE, --keep-alive PRESENT, awaiting Ctrl+C...", flush=True)
i access the config to disable capturing using the request fixture
but how can I do the same from a hook?
guilledk
@guilledk:matrix.org
[m]
the more general question would be how to print output from a hook
dtux
@dmtucker:matrix.org
[m]
I think it depends on the hook, some get passed the config/terminalwriter objects (e.g. pytest_configure or pytest_terminal_summary)
guilledk
@guilledk:matrix.org
[m]
managed to do it like this:
def pytest_sessionstart(session):

    terminal_reporter = session.config.pluginmanager.get_plugin('terminalreporter')
    capture_manager = session.config.pluginmanager.get_plugin('capturemanager')
    with capture_manager.global_and_fixture_disabled():

        terminal_reporter.write("connecting to docker daemon...", flush=True)
and at session finish:
def pytest_sessionfinish(session, exitstatus):

    terminal_reporter = session.config.pluginmanager.get_plugin('terminalreporter')
    capture_manager = session.config.pluginmanager.get_plugin('capturemanager')
    with capture_manager.global_and_fixture_disabled():
        vtestnet = get_testnet()
        if vtestnet and session.config.getoption('--keep-alive'):
            ports = waitfor(vtestnet, ('NetworkSettings', 'Ports', '8888/tcp'))
            container_port = ports[0]['HostPort']
            endpoint = f'http://localhost:{container_port}'

            terminal_reporter.ensure_newline()
            terminal_reporter.write(f"\nAccess the running testnet at {endpoint}\n")
            terminal_reporter.write("--keep-alive PRESENT, awaiting Ctrl+C...", flush=True)

            try:
                while True:
                    time.sleep(100000)

            except KeyboardInterrupt:
                pass

        terminal_reporter.write("\nstopping chain...", flush=True)

        get_exit_stack().pop_all().close()

        terminal_reporter.write(" done.", flush=True)
result:
guilledk
@guilledk:matrix.org
[m]
hey guys im running pytest 6.2.5 on python 3.10.0 and if I run pytest --help in the text it describes a command line option --log-cli of type bool
but if I try to use it as a flag or pass it a value pytest complains about that option not existing
[guille@hardPC pytest-eosio]$ sudo pytest --log-cli
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --log-cli
  inifile: /home/guille/Documents/pytest-eosio/pytest.ini
  rootdir: /home/guille/Documents/pytest-eosio
I know i can set it on a pytest.ini file, but im trying to setup a CI and it would be easier to pass it through command line arguments
1 reply
to have a run with logging enabled and one with it disabled
if its a confirmed issue im willing to contribute a patch but i want to confirm im not missing something obvious
buen_chico
@goodboy:matrix.org
[m]
guilledk: i saw that same thing recently
i think it may be a bug
or it's at least documented really poorly
dtux
@dmtucker:matrix.org
[m]
does it repro with an arg after? sudo pytest --log-cli .
buen_chico
@goodboy:matrix.org
[m]
oh yeah i'm noticing now they broke it out
guilledk
@guilledk:matrix.org
[m]
just tried it and yes