Code Monkey home page Code Monkey logo

Comments (20)

masayukig avatar masayukig commented on September 28, 2024

In my local environment, the run command works from the stestr shell(interactive mode) like below.

(stestr) run stestr.tests.test_utils.TestUtils.test_cleanup_test_name_strip_scenario_and_attrs
{0} stestr.tests.test_utils.TestUtils.test_cleanup_test_name_strip_scenario_and_attrs [0.000470s] ... ok

But yeah, I think that conflict should be happened.

from stestr.

mtreinish avatar mtreinish commented on September 28, 2024

Hmm, I only tried running 'run' by itself, without any arguments and I definitely got an error with that.

from stestr.

masayukig avatar masayukig commented on September 28, 2024

so, I also did it, and it works.. I don't know why.. But I think there is something wrong with the shell mode, anyway.

$ stestr
(stestr) run
{0} stestr.tests.repository.test_file.TestFileRepository.test_initialise [0.002374s] ... ok
<SNIP>
======
Totals
======
Ran: 108 tests in 28.9085 sec.
 - Passed: 106
 - Skipped: 2
 - Expected Fail: 0
 - Unexpected Success: 0
 - Failed: 0
Sum of execute time for each test: 104.9565 sec.

==============
Worker Balance
==============
 - Worker 0 (32 tests) => 0:00:25.821829
 - Worker 1 (32 tests) => 0:00:27.695498
 - Worker 2 (34 tests) => 0:00:24.687430
 - Worker 3 (10 tests) => 0:00:26.987423
(stestr) 

from stestr.

mtreinish avatar mtreinish commented on September 28, 2024

hmm, now it's working for me too. I could have sworn it was failing on me before. I do get an error running help bare now (which definitely wasn't the case before because that's how I fond the conflict):

(stestr) help
ERROR: Invalid syntax: list.remove(x): x not in list

from stestr.

masayukig avatar masayukig commented on September 28, 2024

heh, same here :-p
It's might depend on libraries version??

from stestr.

masayukig avatar masayukig commented on September 28, 2024

It seems something has been changed in cmd2 0.8.0. When I install cmd2 0.7.9, this bug is showed up. And when I use 0.8.0, the behavior is like the above..

<cmd2: 0.8.0>
(stestr) run
help

Shell commands (type help <topic>):
===================================
cmdenvironment  exit  history  py        quit  save  shell      show
edit            help  load     pyscript  run   set   shortcuts

Application commands (type help <topic>):
=========================================
complete  failing  help  init  last  list  load  run  slowest

(stestr) 

from stestr.

masayukig avatar masayukig commented on September 28, 2024

Oh, run command has been removed in 0.8.0 :)

https://github.com/python-cmd2/cmd2/blob/master/CHANGELOG.md#080-february-1-2018

Commands Removed

    The cmdenvironment has been removed and its functionality incorporated into the -a/--all argument to set
    The show command has been removed. Its functionality has always existing within set and continues to do so
    The save command has been removed. The capability to save commands is now part of the history command.
    The run command has been removed. The capability to run prior commands is now part of the history command.

But load is still an issue..

(stestr) load
NoneType: None
ERROR: load command requires a file path:

from stestr.

masayukig avatar masayukig commented on September 28, 2024

OK, I'll push a patch for bumping up the cmd2 version to keep the consistent behavior.

from stestr.

masayukig avatar masayukig commented on September 28, 2024

I pushed the patch for the requirements project https://review.openstack.org/548209
requirements -> cliff -> stestr

from stestr.

masayukig avatar masayukig commented on September 28, 2024

The patch was merged already. run command should work now. load doesn't yet though.

from stestr.

mtreinish avatar mtreinish commented on September 28, 2024

@masayukig do we need to bump the cliff minimum version or anything to ensure this is in a good state?

from stestr.

masayukig avatar masayukig commented on September 28, 2024

@mtreinish yeah, I think so. But we can't do it yet because the cmd2>=0.8.0 patch wasn't in the latest cliff release. So, for now, users need to update cmd2 to the latest if the installed version is lower than 0.8.0.

from stestr.

mtreinish avatar mtreinish commented on September 28, 2024

@masayukig is there any update on this. I'm planning to push a 2.4.0 release soon and getting a fix in for this before that would be great.

from stestr.

masayukig avatar masayukig commented on September 28, 2024

In my stestr env, the cmd2 version is already >=0.8.0 which doesn't have run command itself. So, it looks there's no problem in py27.

$ source .tox/py27/bin/activate
(py27) 
$ pip freeze| grep -e cmd2 -e cliff
cliff==2.14.1
cmd2==0.8.9

$ stestr
(stestr) help

Shell commands (type help <topic>):
===================================
alias  exit  history  py        quit  shell      unalias
edit   help  load     pyscript  set   shortcuts

Application commands (type help <topic>):
=========================================
complete  failing  help  init  last  list  load  run  slowest

However, in my py37 env, there's an issue like this..

$ source .tox/py37/bin/activate
(py37) 
$ pip freeze| grep -e cmd2 -e cliff
cliff==2.14.1
cmd2==0.9.12

$ stestr
(stestr) set debug true
debug - was: False
now: True
(stestr) help
Traceback (most recent call last):
  File "/home/masayuki/git/stestr/.tox/py37/lib/python3.7/site-packages/cmd2/cmd2.py", line 1739, in onecmd_plus_hooks
    statement = self.precmd(statement)
  File "/home/masayuki/git/stestr/.tox/py37/lib/python3.7/site-packages/cliff/interactive.py", line 172, in precmd
    statement.command = cmd_name
  File "/home/masayuki/git/stestr/.tox/py37/lib/python3.7/site-packages/attr/_make.py", line 428, in _frozen_setattrs
    raise FrozenInstanceError()
attr.exceptions.FrozenInstanceError
EXCEPTION of type 'FrozenInstanceError' occurred with message: ''
(stestr) 

I changed the cmd2 version to 0.8.9, then there's no problem of 'stestr help` like this. So, I think there is something between 0.8.9 and 0.9.12.

(py37) 
$ pip install cmd2==0.8.9
$ stestr
(stestr) help

Shell commands (type help <topic>):
===================================
alias  exit  history  py        quit  shell      unalias
edit   help  load     pyscript  set   shortcuts

Application commands (type help <topic>):
=========================================
complete  failing  help  init  last  list  load  run  slowest

from stestr.

mtreinish avatar mtreinish commented on September 28, 2024

Should we bump the minimum cliff version to make sure we pull in a new enough cmd2 version?

from stestr.

masayukig avatar masayukig commented on September 28, 2024

I don't think we should do it because the shell mode doesn't work completely at the latest cliff(cmd2) version now.. :(

Does it work in your environment?

from stestr.

masayukig avatar masayukig commented on September 28, 2024

So, I think we probably should cap the version like as openstack for now..
https://bugs.launchpad.net/python-cliff/+bug/1810213
https://review.opendev.org/#/c/629269/

from stestr.

masayukig avatar masayukig commented on September 28, 2024

I can't cap the cmd2 version by tox. I actually have no idea for this behavior..

$ git diff
diff --git a/tox.ini b/tox.ini
index 3af11ee..4259004 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,7 +8,8 @@ usedevelop = True
 install_command = pip install -U --force-reinstall {opts} {packages}
 setenv = VIRTUAL_ENV={envdir}
 whitelist_externals = find
-deps = -r{toxinidir}/requirements.txt
+deps = -c{toxinidir}/upper-constraints.txt
+       -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
 commands =
     python tools/find_and_rm.py

$ \cat upper-constraints.txt
cmd2===0.8.9
$ tox -e py37 -r
py37 recreate: /home/masayuki/git/stestr/.tox/py37
py37 installdeps: -c/home/masayuki/git/stestr/upper-constraints.txt, -r/home/masayuki/git/stestr/requirements.txt, -r/home/masayuki/git/stestr/test-requirements.txt
py37 develop-inst: /home/masayuki/git/stestr
py37 installed: alabaster==0.7.12,alembic==1.0.10,attrs==19.1.0,Babel==2.6.0,certifi==2019.3.9,chardet==3.0.4,cliff==2.14.1,cmd2==0.9.12,
<SNIP> ..

$ source .tox/py37/bin/activate
(py37) 
$ pip freeze| grep -e cmd2 -e cliff
cliff==2.14.1
cmd2==0.9.12

from stestr.

mtreinish avatar mtreinish commented on September 28, 2024

I think it's because you're using python3. Looking at the requirements for cliff, it only caps <0.9.0 on python2:
https://github.com/openstack/cliff/blob/master/requirements.txt#L5-L6

As for why your constraints file didn't work it looks like you have a typo there, it should be cmd2==0.8.9 not cmd2===0.8.9

from stestr.

masayukig avatar masayukig commented on September 28, 2024

tl;dr
I couldn't find a way to cap the cmd2 version in Python3 so far..


I think it's because you're using python3. Looking at the requirements for cliff, it only caps <0.9.0 on python2:
https://github.com/openstack/cliff/blob/master/requirements.txt#L5-L6

yeah, I see. So, I tried to use -c option with my upper-constraints.txt.

As for why your constraints file didn't work it looks like you have a typo there, it should be cmd2==0.8.9 not cmd2===0.8.9

Oh, really? I copied and pasted the openstack's one.
https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt

cmd2===0.8.9

And it works with the command line like following but not with tox like the above..

$ pip install -U --force-reinstall -c upper-constraints.txt -r requirements.txt -r test-requirements.txt
<SNIP>
$ pip freeze | grep -e cmd2 -e cliff
cliff==2.14.1
cmd2==0.8.9

from stestr.

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.