question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

load config from Source or similar to increase testability

See original GitHub issue

Right now the loadConfig methods provided by pureconfig are oriented around java.nio.Paths 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:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ruippeixotogcommented, Dec 17, 2017

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 a String IMO, but from a Java Reader (there’s Source#reader() and ConfigFactory.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 of ConfigCursors, 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 of ConfigValue. As such, I wouldn’t personally feel like I was breaking some abstraction layer by creating a Config manually.

0reactions
keirlawsoncommented, Dec 23, 2017

Ok, will close issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found