@@ -330,6 +330,13 @@ def test_create_error(self):
330
330
self .outputs )
331
331
332
332
def test_create (self ):
333
+ # let's deactivate all current plugins and commands; this is not
334
+ # important to test the creation but it is important to test if a
335
+ # command is active as the new commands should take precedence and
336
+ # should make the old commands active if they have the same name
337
+ qdb .software .Software .deactivate_all ()
338
+
339
+ # note that here we are adding commands to an existing software
333
340
obs = qdb .software .Command .create (
334
341
self .software , "Test Command" , "This is a command for testing" ,
335
342
self .parameters , self .outputs )
@@ -351,6 +358,7 @@ def test_create(self):
351
358
{'parameters' : [], 'outputs' : [],
352
359
'ignore_parent_command' : False })
353
360
361
+ # here we are creating a new software that we will add new commads to
354
362
obs = qdb .software .Command .create (
355
363
self .software , "Test Command 2" , "This is a command for testing" ,
356
364
self .parameters , analysis_only = True )
@@ -422,6 +430,22 @@ def test_create(self):
422
430
'ignore_parent_command' : False }
423
431
self .assertEqual (obs .merging_scheme , exp )
424
432
433
+ # now that we are done with the regular creation testing we can create
434
+ # a new command with the name of an old deprecated command and make
435
+ # sure that is not deprecated now
436
+ # 1. let's find the previous command and make sure is deprecated
437
+ cmd_name = 'Split libraries FASTQ'
438
+ old_cmd = [cmd for cmd in self .software .commands
439
+ if cmd .name == cmd_name ][0 ]
440
+ self .assertFalse (old_cmd .active )
441
+
442
+ # 2. let's create a new command with the same name and check that now
443
+ # the old and the new are active
444
+ new_cmd = qdb .software .Command .create (
445
+ software , cmd_name , cmd_name , parameters , outputs = outputs )
446
+ self .assertTrue (old_cmd .active )
447
+ self .assertTrue (new_cmd .active )
448
+
425
449
def test_activate (self ):
426
450
qdb .software .Software .deactivate_all ()
427
451
tester = qdb .software .Command (1 )
0 commit comments