Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring: DRY up the code #3

Open
steveloranz opened this issue Feb 25, 2014 · 2 comments
Open

Refactoring: DRY up the code #3

steveloranz opened this issue Feb 25, 2014 · 2 comments

Comments

@steveloranz
Copy link
Contributor

The current tree was done as a POC and there are some redundant cut-and-pasted sections that could use some cleaning up.

@steveloranz steveloranz self-assigned this Mar 14, 2014
@steveloranz steveloranz added this to the 20140404 milestone Mar 14, 2014
@steveloranz
Copy link
Contributor Author

@imcleod - I'm working with SHA: 3f2d0d9 and seeing the following stack trace when running the test_cacheManager tests.

Traceback (most recent call last):
  File "/usr/lib64/python2.7/unittest/case.py", line 369, in run
    testMethod()
  File "/usr/lib/python2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/root/sloranz/src/novaimagebuilder/tests/test_cacheManager.py", line 25, in <module>
    sys.modules['StackEnvironment'] = sys.modules.pop('MockStackEnvironment')
KeyError: 'MockStackEnvironment'

Rather than messing with the loaded modules, I'm proposing that we change CacheManager so that one can set the stack environment. This requires no conditional logic in the CacheManager class or any other real class and is something that would be set by the unit test.

Comment?

@steveloranz
Copy link
Contributor Author

This was dependent on the test runner being used. For whatever reason, I had PyCharm setup to use python unittest for all tests but nose for the single test. Switching to utrunner instead of noserunner fixed my issue without having to muck around with the python path.

@steveloranz steveloranz removed their assignment Jun 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant