Opened 9 years ago

Closed 6 years ago

#7493 closed enhancement (duplicate)

Implement sage -t --time

Reported by: nthiery Owned by: tbd
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: doctest coverage Keywords:
Cc: Merged in:
Authors: Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

When a test file takes time to execute, it would be handy to have a quick overview of which specific tests take long.

Something like:

    sage -t --verbose --time bla.py
    Trying: 
        1+1
    Expecting:
        2
    ok [0.1ms]
    Trying: 
        factor(....)
    Expecting:
        ...
    ok [10s] warning: please use # long time
    Trying: 
        factor(.....) # long time
    Expecting:
        ...
    ok [10s]
    Trying: 
        factor(........)
    Expecting:
        ...
    ok [300s] warning: this is too long!

And in non verbose mode:

    sage -t --time bla.py
    Warning: factor(....) line 30 takes 10s: please use # long time
    Warning: factor(........) line 50 takes 300s: this is too long!

Attachments (1)

trac_7493-check-long-time.patch (2.8 KB) - added by nthiery 9 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 9 years ago by nthiery

  • Report Upstream set to N/A

Here is a patch which sorts of do the job. It is not intended to be merged, but to make you crave enough for the feature to actually implement it right:

zephyr-~s/categories>sage -t -time coxeter_groups.py    
sage -t -time "4.3/devel/sage-combinat/sage/categories/coxeter_groups.py"
...
File "/opt/sage-4.3/devel/sage-combinat/sage/categories/coxeter_groups.py", line 1010:
    sage: for u in P4:
          for v in P4:
              assert u.bruhat_lequal(v) == P4toW(u).bruhat_le(P4toW(v))
Expected nothing
Got:
    Warning: test took 8.1s > 1s. Please use # long time
Total time for all tests: 24.0 seconds

comment:2 follow-up: Changed 9 years ago by AlexGhitza

Nicolas, can you actually attach your toy patch to this ticket? I've now been in a few situations where I'm staring at the output of sage -t -verbose, and having *anything* automated for this would be a great help to my sanity.

Changed 9 years ago by nthiery

comment:3 in reply to: ↑ 2 Changed 9 years ago by nthiery

Replying to AlexGhitza:

Nicolas, can you actually attach your toy patch to this ticket? I've now been in a few situations where I'm staring at the output of sage -t -verbose, and having *anything* automated for this would be a great help to my sanity.

Oops, there it is.

Eh eh, maybe my strategy is going to work :-)

comment:4 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-wishlist to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Reviewers set to Jeroen Demeyer
  • Status changed from new to closed

This is essentially all implemented in #12415.

Note: See TracTickets for help on using tickets.