2010-05-22 1 views
1

명령 줄에서 재정의 매개 변수를 전달한 경우에만 nose-testconfig plugin을 사용하여 여러 구성 매개 변수를 재정의 할 수 있습니다. 내가 마지막 매개 변수 만 값보다 nose.cfg 내에서 같은 일을 정의 할 때noseetests에서 nose-testconfig 0.6 플러그인을 사용하여 여러 재정의 매개 변수를 전달할 수 없습니다.

nosetests -c nose.cfg -s --tc=jack.env1:asl --tc=server2.env2:abc 

그러나 수정됩니다. 예 :

플러그인 코드를 확인했습니다. 그것은 나에게 잘 보인다.

parser.add_option(

     "--tc", action="append", 
     dest="overrides", 
     default = [], 
     help="Option:Value specific overrides.") 

구성 :

if options.overrides: 
     self.overrides = [] 
     overrides = tolist(options.overrides) 
     for override in overrides: 
      keys, val = override.split(":") 
      if options.exact: 
       config[keys] = val 
      else:      
       ns = ''.join(['["%s"]' % i for i in keys.split(".") ]) 
       # BUG: Breaks if the config value you're overriding is not 
       # defined in the configuration file already. TBD 
       exec('config%s = "%s"' % (ns, val)) 

어느 한 어떤 단서가 있으면 알려주세요 여기에 플러그인 코드의 일부입니다.

+0

구성 파일의 모양을 표시 할 수 있습니까? –

답변

0

찾아주세요 아래에있는 내 nose.cfg 파일 :

[nosetests] 
verbosity=2 

tc-file = setup_config.py 

tc-format = python 

all-modules = True 

tc = server2.env2:abc 

tc = jack.env1:asl 

내 설정 파일과 같이 보인다 : 위의 예만을 jack.env1에서

[server2] 

env2=server2 

[jack] 

env1=server1 

: AS1 값이 유효합니다 (즉, 마지막 값). 하지만 두 값이 모두 같지 않은 명령 줄에서 동일한 값을 지정하면

관련 문제