Failing tests reported by Racket repo

My first try to create a package on racket-lang.org package repo, and I have a question (so far only one :grin:).

I created a package there earlier today, and there were some orange remarks about license, about missing docs... That I really could not understand, because I checked (after checking racket docs) and my info.rkt file looked OK. Anyway I left it like that. Now a few hours later, all seems OK. All green, but there's a new problem. Orange button "failing tests"

After checking the test printout, it seems that two failing tests both timed out after 90 seconds. I verified that by running locally

raco test -p math-quiz

And yes, this time-out is math-quiz starting a GUI window, and waiting for user input. As I'm new to modules, when "raco pkg install" run in my math-quiz directory, it created a main.rkt program, that I did not have before. So, the only thing I did with it is to add (require "math-quiz.rkt"), that was the main module before. Anyway result is that both of these files could start the program (GUI).
My remedy was to include this in main.rkt:

(require "math-quiz.rkt")

;;; Starting the GUI
;;; ===========================================================
(send main-window show #t)
;;; disable popup menus
(disable/enable-popup-window-menu #f)

And to remove above commands from math-quiz.rkt file. So now only main module can start the GUI.

And then in info.rkt I added this:

(define test-omit-paths '("main.rkt"))

When tested locally with raco test, all tests run OK.

I can safely omit tests on main.rkt module, because apart from above 3 lines, there's nothing there.

These mods are now pushed to GitHub.

So, my question is this: do I have to edit the package on racket-lang.org repo, or will this be taken care of automatically?

1 Like

This question is solved by the Racket repo. It updated the tests automatically and now all passed.

an alternative: check if the CI environment variable is set, and skip tests if so

that way lets you run some tests in a file & skip others

Thanks. I looked into this, but I wasn't able to figure out how this works. Anyway, no problem. My original fix works well.

test-omit-paths is perfect for excluding an entire file (or subdirectory).

Someday, if you ever do want to skip only some tests within a file, what @ben_greenman mentioned works well. It's really just wrapping them in a conditional:

(unless (getenv "CI")
  ;; tests
  )

I'm 99% sure the Racket package build service also sets "CI".


p.s. Rarely you might have a test that works everywhere but the Racket package build server. (Maybe the test does HTTP requests to some public server, which doesn't like requests from there. Or whatever reason.) For that, same technique, just a different env var:

(unless (getenv "PLT_PKG_BUILD_SERVICE")
  ;; tests
  )

Thanks, now I get this. The problem with the ben_greenman answer was that I read CI as Cl.