Hi,

On Fri, Apr 06, 2018 at 09:46:48PM +0000, Simon King wrote:
> Hi!
> 
> Working on finally getting my group cohomology spkg back to work (at
> #18514), it seems that internet access during doctests became an issue
> --- again!
> 
> Actually that issue has a long history:
> 
> - More than three years ago, internet access during doctests was not
>   blocked. So, in my old cohomology spkg, all web-accessing functions
>   used to test (by some kind of introspection) whether they were called
>   as part of a doctest, and would never try to access internet during
>   doctests, UNLESS a special parameter was set to explicitly allow
>   internet access in a few well-chosen tests.
> 
> - About three years ago, Sage changed so that internet access during
>   doctests was now blocked. Hence, the afore-mentioned well-chosen
>   tests failed, because now no internet access was possible whatsoever.
>   I dealt with it by modifying the well-chosen tests so that web
>   access was simulated by local file access.
> 
> - Now in SOME very specific configuration (namely: my laptop plugged
>   with an ethernet cable in my office) the test suite hangs, i.e., a
>   wall time of more than 4 hours with a CPU time of 20 minutes.
>   
> Jeroen seems to be convinced that internet access is to blame. It
> makes me wonder and gives rise to a whole bunch of questions.
> 
> 1. Is it really true that Sage currently does NOT block internet
>    access during doctests, i.e., has returned to the situation more
>    than three years ago?

I am not sure internet access was ever blocked. Anyway, the recommended
way to deal with doctests and internet is to tag every doctest that
requires internet access with:

        # optional -- internet

By default, they will not be run while doctesting. If you want them to be
doctested, you have to add the

        --optional=internet

option to your 'sage -t' call.

> If the answer to 1. is "yes", then the follow-up questions are these:
> 
> 2. Why has Sage returned to allowing internet access?
> 3. Is there some way (say, by some environment variable) to actively
>    block all internet access while `sage -t` runs?

        sudo iptables -A OUTPUT -j ACCEPT -o lo
        sudo iptables -A OUTPUT -j ACCEPT -o 127.0.0.1
        sudo iptables -A OUTPUT -j DROP

But i guess this is not what you want.

Ciao,
Thierry


> 4. If there isn't: Is it at least possible to block internet access
>    by adding some command at the beginning of each test (say, by setting
>    a timeout in urllib2 to zero or so)?
> 5. How can one test inside of a python function f whether f was called
>    as part of a doctest? I.e., is the doctesting framework detectable by
>    introspection?
> 
> To be more specific: By "block internet access" I mean that any attempt to
> access internet via urllib2 will IMMEDIATELY fail, without a long delay.
> 
> If the anser to 1. is "no", then the follow-up question is this instead:
> 
> 6. If internet access is not to blame after all, then what alternative
>    explanation do you have for the fact that THE SAME spkg's test suite
>    on THE SAME laptop works fine when the laptop is connected with WLan
>    at home, bug hangs when the laptop is connected with ethernet cable
>    in my office?
> 
> Jeroen and John Palmieri did test the spkg at #18514, however it didn't
> become clear to me whether the tests hang for them. If I understand
> correctly, Jeroen confirms that internet is accessed during the tests
> and he can imagine that a failure in accessing the internet may involve
> a long delay.
> 
> Best regards,
> Simon
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to