Doctests of package objects are in the wrong package
See original GitHub issueI tried to upgrade sbt-doctest from 0.8.0 to 0.9.1 in refined but the Doctest of this package object fails to compile because it is now in a different package.
Here is the Doctest generated by 0.8.0:
package eu.timepit.refined
object packageDoctest
extends _root_.org.scalacheck.Properties("package.scala") {
def sbtDoctestTypeEquals[A](a1: => A)(a2: => A): _root_.scala.Unit = ()
def sbtDoctestReplString(any: _root_.scala.Any): _root_.scala.Predef.String = {
val s = _root_.scala.runtime.ScalaRunTime.replStringOf(any, 1000).init
if (s.headOption == Some('\n')) s.tail else s
}
include(new _root_.org.scalacheck.Properties("package.scala:9: W") {
val d: W.`3.14`.T = 3.14
val s: W.`"abc"`.T = "abc"
})
}
and this is what 0.9.1 generates:
package eu.timepit
object packageDoctest
extends _root_.org.scalacheck.Properties("package.scala") {
def sbtDoctestTypeEquals[A](a1: => A)(a2: => A): _root_.scala.Unit = {
val _ = () => (a1, a2)
}
def sbtDoctestReplString(any: _root_.scala.Any): _root_.scala.Predef.String = {
val s = _root_.scala.runtime.ScalaRunTime.replStringOf(any, 1000).init
if (s.headOption == Some('\n')) s.tail else s
}
include(new _root_.org.scalacheck.Properties("package.scala:9: W") {
val d: W.`3.14`.T = 3.14
val s: W.`"abc"`.T = "abc"
})
}
The difference between these two that to causes the compilation failure is in the first line:
--- packageDoctest_0.8.0.scala 2018-08-24 22:59:56.000000000 +0200
+++ packageDoctest_0.9.1.scala 2018-08-24 22:53:34.000000000 +0200
@@ -1,4 +1,4 @@
-package eu.timepit.refined
+package eu.timepit
I think the behaviour of 0.8.0 with regards to package objects should be restored.
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
doctest — Test interactive Python examples — Python 3.11.1 ...
It is an error to specify package if module_relative is False . Optional argument setUp specifies a set-up function for the test suite....
Read more >Doctest and relative imports - python - Stack Overflow
The simple solution is just to get rid of the relative imports. Are there any others? Say I have a package called example...
Read more >Error in doctest on namespace package with Python 3.7 #3276
There seems to be an emergent issue with pytest when running --doctest-modules on Python 3.7. Here's a run of jaraco.functools' tests: $ tox ......
Read more >How To Write Doctests in Python - DigitalOcean
The doctest module programmatically searches Python code for pieces… ... Sometimes there may not be a right or wrong answer.
Read more >doctest — Testing Through Documentation — PyMOTW 3
doctest tests source code by running examples embedded in the documentation ... become tedious as a package spreads out into multiple files.
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
this was probably introduced by me when I migrated to scalameta. Will try to fix it
great! I guess this can be a workaround for now.
@fthomas @tkawachi Do you guys think it’s worth to update README explaining that scalameta in plugins classpath has to be 3.7.x+ and as such sbt-scalafmt (if used) should be 1.6.x?