load config from Source or similar to increase testability
See original GitHub issueRight now the loadConfig
methods provided by pureconfig are oriented around java.nio.Path
s when a non-default location is required. However for those wishing to unit test their configuration code without having said tests go to the filesystem, this presents a problem as Path
is not readily mocked. To this end I would propose adding another variant of loadConfig
that takes something less tightly bound to the filesystem itself. Options include fs2 streams which would be nice however I suspect pureconfig does not want to introduce a dependency on fs2? Otherwise, scala.io.Source
seems like a good candidate.
If this idea is deemed useful happy to provide a PR.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
kaocha/09_extending.md at main - GitHub
When implementing -load your job is to transform a configuration testable into a test-plan testable, so you should dissoc :kaocha/tests and assoc :kaocha.test- ......
Read more >Testability and Entity Framework 4.0 - EF6 - Microsoft Learn
This white paper describes and demonstrates how to write testable code with the ADO.NET Entity Framework 4.0 and Visual Studio 2010. This paper ......
Read more >16 ways software testability can assist manual testing
This concept of testability makes improving UI, API, and integration testing relatively ... Store the base config files in source control.
Read more >HAL testability check | Android Open Source Project
Compliance tests ensure compatibility between framework and vendor partitions. These tests are required to be run (and pass) on devices ...
Read more >"No such module" when using @testable in Xcode Unit tests
In the Project Navigator click your project name. Select Build Settings and scroll down to Build Options. Make sure that Enable Testability is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m ok with adding an overloaded
loadConfig(source: Source)
to our API, if the other authors agree. The most elegant bridge wouldn’t be through aString
IMO, but from a JavaReader
(there’sSource#reader()
andConfigFactory.fromReader
).Please bear in mind that, while there’s an open issue to make PureConfig independent from the backend API, that’s not at all the case right now. Typesafe Config is not a simple transitive dependency: our API intentionally does not abstract over it and
com.typesafe.config.Config
is not purely an intermediary, but our core model of a config. On the upcoming version there will be a greater distance from concrete backends with the implementation ofConfigCursor
s, but if you are using the current version (0.8.0) and you need to add support for a custom type, you’ll still have to deal with instances ofConfigValue
. As such, I wouldn’t personally feel like I was breaking some abstraction layer by creating aConfig
manually.Ok, will close issue.