These are chat archives for etorreborre/specs2

16th
Dec 2016
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 11:01
hi, I don't seem to be able to pass the timeFactor via system properties, e.g. -Dspecs2.timeFactor=3 doesn't work (if I print the property in the test it's correctly set to 3, but the executionEnv.timeFactor is still 1). Any ideas?
Eric Torreborre
@etorreborre
Dec 16 2016 12:02
@TrustNoOne which version are you using?
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:03
the most recent, let me check
3.8.6
Eric Torreborre
@etorreborre
Dec 16 2016 12:03
ok, I need to check that
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:04
I am just printing one after the other "System.getProperty("specs2.timeFactor") and ee.timeFactor" and I get 3 and 1, so it's not taking it
Eric Torreborre
@etorreborre
Dec 16 2016 12:04
Your spec looks like class MySpec(ee: ExecutionEnv) extends Specification, right?
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:04
I took a look at the code and it seems to read it from the "arguments"
yes correct
just a simple spec with an ExecutionEnv
if i pass it via arguments with testOnly -- timeFactor 3 it works
in ExecutionEnv.create it's set by arguments.execute.timeFactor
oh, I am running the test in a forked jvm, but the system property seems to be there
umh wait, now that I mention it... Maybe I'm setting the property in the wrong place? I'm doing javaOptions in Test += "-Dspecs2.timeFactor=3" (and I have fork in Test := true)
Eric Torreborre
@etorreborre
Dec 16 2016 12:08
I'm not sure the options are passed ok in forked mode, are they?
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:09
the System property seems to be there, what do you mean by options?
Eric Torreborre
@etorreborre
Dec 16 2016 12:09
the system properties
but yes they should be there when forking
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:09
oh ok, then it's there. I even set some other props for other reasons
Eric Torreborre
@etorreborre
Dec 16 2016 12:10
can you try to print Arguments().execute.timeFactor in your spec? timeFactor should be read from system properties
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:10
sure right away, 1 min I need to recompile
Eric Torreborre
@etorreborre
Dec 16 2016 12:14
sorry I need to step away from my laptop for a bit
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:15
np, I'm just running the test I'm not in a hurry anyway :)
I was doing something else so I had to switch back to master and recompile, now it's not passing the property. But I'm sure I've done it before, or maybe I'm just very tired lol :| I'll let you know as soon as I manage to reproduce it :\
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:23
ok, i AM tired, I was typing timefactor instead of timeFactor :D
here is the code:
class MyTest(implicit ee: ExecutionEnv) extends Specification {
  "test" should {
    "work" in {
      println("specs2.timeFactor=" + System.getProperty("specs2.timeFactor"))
      println("ee.timeFactor=" + ee.timeFactor)
      println("Arguments().execute.timeFactor=" + Arguments().execute.timeFactor)
      ok
    }
  }
}
and here is the output:
specs2.timeFactor=4
ee.timeFactor=1
Arguments().execute.timeFactor=1
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:28
I'm going to have lunch now, let me know if you want me to open an issue :)
Giovanni Caporaletti
@TrustNoOne
Dec 16 2016 12:34
this is how I ran it:
set javaOptions in Global += "-Dspecs2.timeFactor=4"
testOnly *MyTest