Re: [PATCH 1/3] Fix traceback if modules cannot be loaded when running tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> diff --git a/tests/baseclass.py b/tests/baseclass.py
> index f8a5db2..a1b6e28 100644
> --- a/tests/baseclass.py
> +++ b/tests/baseclass.py
> @@ -163,12 +163,16 @@ def loadModules(moduleDir, cls_pattern="_TestCase", skip_list=["__init__", "base
>              continue
>  
>          # Attempt to load the found module.
> +        loaded = None
>          try:
>              found = imputil.imp.find_module(module)
>              loaded = imputil.imp.load_module(module, found[0], found[1], found[2])
>          except ImportError, e:
>              print(_("Error loading module %s.") % module)
>  
> +        if not loaded:
> +            continue
> +
>          # Find class names that match the supplied pattern (default: "_TestCase")
>          beforeCount = len(tstList)
>          for obj in loaded.__dict__.keys():

This can be reduced to just putting a continue in the exception handler.

Good catch.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux