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

The tests for ConfigReader are getting unmaintainable and could use being refactored #1251

Open
jfalkenstein opened this issue Aug 1, 2022 · 1 comment

Comments

@jfalkenstein
Copy link
Contributor

jfalkenstein commented Aug 1, 2022

The ConfigReader is one of the most critical components of Sceptre. However, it's unit tests are loaded with patches and seem to have been largely copied and pasted over and over again. There are even patches covering internal private methods within the ConfigReader. Furthermore, there is reliance upon existing files in the file system, which can make for odd behavior in tests and relies upon the working directory when running tests to be set to the root directory.

We really could use a new, refactored suite of tests on the ConfigReader that provide better coverage, better maintainability, and better readability without relying so heavily on patching.

We should make good use of tools and patterns such as:

  • Dependency injection (might require some slight modifications to reader code itself to make this possible)
  • Fake filesystems when needing to simulate files (e.g. pyfakefs)

The end result of this refactoring should be a series of concise, well-named tests that generally have a single assertion per test.

@jfalkenstein
Copy link
Contributor Author

For the record, I'd be willing to help anyone who picks this up by consulting them on what sorts of things ought to be tested and good unit test practices and such, if they would like it.

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

2 participants