Organizing tests in project

78 views
Skip to first unread message

Siddhartha Kasivajhula

unread,
Mar 17, 2020, 3:26:12 PM3/17/20
to Racket Users
Hi,
I'm attempting to organize tests in my package into subfolders/modules instead of having them in a giant main.rkt test submodule, but am running into some issues and was hoping for some advice on the best way to do it. I think the primary issue is related to source compilation order in raco, but am also curious how other people organize their tests.

I've moved all of the tests into a tests/ subfolder in the main project tree. When I build the project using raco setup, it builds both the project files as well as the tests contained in the tests/ folder. At this point, if I run the tests as is, they result in an error. If instead I first delete the compiled/ subfolder in the tests folder, the tests then work fine.

I think the tests may be getting compiled against the version of the compiled collection which is immediately replaced by a fresh compilation during raco setup. This is the error I'm seeing when I run the tests:

default-load-handler: expected a `module' declaration, but found something else
  file: /Users/siddhartha/work/lisp/racket/relation/tests/compiled/algebraic-test_rkt.dep
  context...:
   default-load-handler
   standard-module-name-resolver
   module-path-index-resolve
   module-declared?

I could add a make target to clean the test compiled folder prior to running tests, but it seemed like there must be a better way. So my main questions are:

1. Is there a way to exclude certain folders (such as tests) in the raco setup stage? For reference, the command I'm using is raco setup --no-docs --tidy --pkgs relation.
2. Is this a good way to organize tests? Are there any standard recommended ways?

Would appreciate any input,
-Sid

Siddhartha Kasivajhula

unread,
Apr 6, 2020, 6:27:27 PM4/6/20
to Racket Users
FTR I fixed this by using the `compile-omit-paths` flag: https://docs.racket-lang.org/raco/setup-info.html
E.g. in info.rkt:

(define compile-omit-paths '("tests"))



Siddhartha Kasivajhula

unread,
Apr 10, 2020, 2:07:39 PM4/10/20
to Racket Users
Hi, I'm still seeing an error on the Racket package server, but the build output is from March 31, 2019 and doesn't seem to be showing updated output. I gather that the server builds packages nightly -- any idea why it hasn't rebuilt yet? Or if it has, is there a way to get updated error output?


Siddhartha Kasivajhula

unread,
Apr 15, 2020, 3:14:46 PM4/15/20
to Racket Users
This morning I find that the package referenced above no longer indicates failure. There haven't been any new commits, so it appears that the package rebuilt on its own without any fresh trigger -- but, notably, after a relatively long (weeks long) interval. Does anyone know if this is normal? This section of the docs appears to suggest that the docs are built daily.


Matthew Flatt

unread,
Apr 15, 2020, 3:58:54 PM4/15/20
to Siddhartha Kasivajhula, Racket Users
The machine that formerly ran pkg-build died, so pkg-builds stopped for
a week or two. I moved eventually moved it to a new machine. Since I
had to start over with a v7.6 installer and the current catalog, all
packages were re-built and re-tested.

At Wed, 15 Apr 2020 12:14:31 -0700, Siddhartha Kasivajhula wrote:
> This morning I find that the package referenced above no longer
> <https://pkgs.racket-lang.org/package/Relation> indicates failure. There
> haven't been any new commits, so it appears that the package rebuilt on its
> own without any fresh trigger -- but, notably, after a relatively long
> (weeks long) interval. Does anyone know if this is normal? This section
> <https://docs.racket-lang.org/pkg/getting-started.html#%28part._register-at-cat
> alog%29>
> of the docs appears to suggest that the docs are built daily.
>
>
>
> On Fri, Apr 10, 2020 at 11:07 AM Siddhartha Kasivajhula <skas...@gmail.com>
> wrote:
>
> > Hi, I'm still seeing an error
> > <https://pkgs.racket-lang.org/package/Relation> on the Racket package
> > server, but the build output is from March 31, 2019
> > <https://pkg-build.racket-lang.org/server/built/test-fail/Relation.txt>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CACQBWFmoQpDCcX5JThPKwfJ9cJDP9jY
> tWKBfyONG7sB37w7YOQ%40mail.gmail.com.

Siddhartha Kasivajhula

unread,
Apr 15, 2020, 4:35:50 PM4/15/20
to Matthew Flatt, Racket Users
I see, that explains it. Thank you for fixing it!


Reply all
Reply to author
Forward
0 new messages