leif
2017-8-14 18:41:17

Is there any way to prevent raco pkg from installing a package? Like, (pre-)install-collection for an info.rkt files, but can also fail.


leif
2017-8-14 18:42:04

The best I can think of is to have my package’s (pre)-install-collection function throw an error. But the collection will still end up installed, even after the error is thrown.


notjack
2017-8-14 18:42:25

There’s a way to turn off raco setup when installing, is that close to what you want?


leif
2017-8-14 18:42:49

@notjack Can I do it programatically from within a package?


leif
2017-8-14 18:43:08

Like, I made package A. But package A requires some system dependency not provided.


leif
2017-8-14 18:43:36

I have code that can check to see if the dependency is met, but if it isn’t met, I can’t really fix it.


leif
2017-8-14 18:43:46

As such, I just want to bail, and don’t install the package.


leif
2017-8-14 18:44:00

(Rather than letting raco finish installing a broken package.)


notjack
2017-8-14 18:44:23

Ah yeah, no idea how to do that


notjack
2017-8-14 18:44:36

That seems like a reasonable thing to want to do though


leif
2017-8-14 18:45:11

Sad day. Well if it’s not possible, I’ll see if its possible to add it.


mflatt
2017-8-14 18:47:25

@leif That doesn’t sound like a good idea. There can be all sorts of reasons to install a package that can’t currently run, including installing to build documentation or a distribution. It’s much better to have the library report a run-time error for unavailable functionality.


leif
2017-8-14 18:48:56

@mflatt Ya, that makes sense, except for when the dep you need is specifically for building. Although I guess in that case an error is just fine.


leif
2017-8-14 18:49:00

Thanks. :slightly_smiling_face:


zenspider
2017-8-14 19:45:05

@greg seems back up/fixed


zenspider
2017-8-14 20:01:51

I’m trying to clean up my package status… it is listing as having test errors. If I run tests in racket-mode, I get zero output. If I run with raco test I get:

% raco test --process -t main.rkt
raco test: (submod "main.rkt" test)
3 14 main.rkt
3/14 test failures

which is entirely not helpful… the package status shows an error, but why am I not getting output with either method? Am I forgetting a flag?



zenspider
2017-8-14 20:07:46

yes… I’m starting to think that we’re running different things tho… I also have NO IDEA why raco test thinks I have 14 tests


zenspider
2017-8-14 20:08:29

If I add a (displayln 'done) at the end of my test module, it prints and then I get the “test failures” line… I have no idea what’s running at this point


samth
2017-8-14 20:09:02

@zenspider which package are you looking at?


lexi.lambda
2017-8-14 20:09:21

fwiw, the “_n_ test failures” line is printed by raco test


zenspider
2017-8-14 20:09:30

I did test coverage in drracket and I only have 2 expressions not covered… and exception and a failure case


zenspider
2017-8-14 20:09:46

but I only have 3 calls to check-exn-info?



zenspider
2017-8-14 20:10:36

nope… the sha’s match… we’re running the same thing


greg
2017-8-14 20:10:53

@zenspider Is that the source?


zenspider
2017-8-14 20:10:58

yup!


samth
2017-8-14 20:11:10

it’s probably all the different calls to check-equal? in loops that adds up to 14


zenspider
2017-8-14 20:11:24

and I only have that displayln diff locally


greg
2017-8-14 20:12:44

cat keeps tapping my trackpad dammit


lexi.lambda
2017-8-14 20:12:48

one of the big flaws of rackunit, imo, is that there is basically no possibility for reuse: you generally cannot define a check in terms of another one without things leaking through


zenspider
2017-8-14 20:12:49

haha


zenspider
2017-8-14 20:13:33

@lexi.lambda agreed. I do a number of define-simple-check or whatever it is… but I don’t pay much attention to the numbers… but in this case, since I’m testing a test function… I’m a bit confused.


zenspider
2017-8-14 20:13:52

still… I don’t know how to reproduce the error that the pkg system is reporting


zenspider
2017-8-14 20:14:28

@notjack ^^^ composable assertions would be really really useful


zenspider
2017-8-14 20:14:55

@samth by my reasoning, the number should be 7, not 14


zenspider
2017-8-14 20:16:49

it’s also running my scribble file? I’m not doing that…


samth
2017-8-14 20:17:34

the pkg build server runs all your files


zenspider
2017-8-14 20:17:39

does anyone know what the flags are?



zenspider
2017-8-14 20:20:32

--drdr did it! thanks


zenspider
2017-8-14 20:21:00

--drdr Configure defaults to imitate DrDr… wtf does that mean?


lexi.lambda
2017-8-14 20:21:21

drdr is the Racket CI server http://drdr.racket-lang.org


zenspider
2017-8-14 20:21:53

wait. no. oops… that didn’t do it. that was the stderr output from the scribble doco checker I stole from somewhere


lexi.lambda
2017-8-14 20:22:33

what command are you running?


zenspider
2017-8-14 20:22:57

@samth looks like the internal links on that page are broken. Try “Dealing with Test Failures”… should I file a bug?


zenspider
2017-8-14 20:23:09

@lexi.lambda raco test --drdr info.rkt main.rkt check-sexp-equal.scrbl


lexi.lambda
2017-8-14 20:23:22

try raco test --drdr -p check-sexp-equal


zenspider
2017-8-14 20:24:20

hrm:

% raco test --drdr -p check-sexp-equal
raco test: 0 "/Users/ryan/Library/Racket/6.9/pkgs/../../../../Work/git/zenspider/check-sexp-equal/check-sexp-equal.scrbl"
raco test: 1 "/Users/ryan/Library/Racket/6.9/pkgs/../../../../Work/git/zenspider/check-sexp-equal/info.rkt"
raco test: 2 (submod "/Users/ryan/Library/Racket/6.9/pkgs/../../../../Work/git/zenspider/check-sexp-equal/main.rkt" test)
   0 /Users/ryan/Library/Racket/6.9/pkgs/../../../../Work/git/zenspider/check-sexp-equal/check-sexp-equal.scrbl
   0 /Users/ryan/Library/Racket/6.9/pkgs/../../../../Work/git/zenspider/check-sexp-equal/info.rkt
3 14 /Users/ryan/Library/Racket/6.9/pkgs/../../../../Work/git/zenspider/check-sexp-equal/main.rkt
3/14 test failures

zenspider
2017-8-14 20:25:08

I don’t want to port minitest to racket… but I’m close. :stuck_out_tongue:


samth
2017-8-14 20:25:40

just some name attributes that should be id attributes — I’ll fix it


lexi.lambda
2017-8-14 20:26:22

I think raco test is okay… it’s mostly agnostic to testing lib. rackunit is eh.


zenspider
2017-8-14 20:27:08

so it COULD work with another testing library? good to know…


lexi.lambda
2017-8-14 20:27:23

raco test just runs your files, basically


zenspider
2017-8-14 20:28:02

can you expand on what you’re “eh” about?


lexi.lambda
2017-8-14 20:28:13

not atm, I’m in a meeting :p


zenspider
2017-8-14 20:28:18

heh. kk. later


lexi.lambda
2017-8-14 20:28:39

but if you’re interested in writing another framework, you can report test results to raco test with test-log! http://docs.racket-lang.org/rackunit/Testing_Utilities.html#%28def._%28%28lib._rackunit%2Flog..rkt%29._test-log%21%29%29


samth
2017-8-14 20:28:49

@zenspider that’s now fixed


lexi.lambda
2017-8-14 20:29:01

it’s documented in the rackunit manual but it’s actually not in the rackunit package


zenspider
2017-8-14 20:29:15

@samth cool! thanks!


samth
2017-8-14 20:29:19

although that page won’t be fixed until 6.11


zenspider
2017-8-14 20:29:27

sure


samth
2017-8-14 20:29:30

but they’re just internal links so it’s not so bad


zenspider
2017-8-14 20:30:38

“Adds a test result to the running log. If result is false, then the test is considered a failure.” … that’s… pretty opaque


lexi.lambda
2017-8-14 20:31:10

it basically just means call (test-log! #t) if the test passes and (test-log! #f) if it fails


lexi.lambda
2017-8-14 20:31:25

raco test uses those calls to display the “n/m test failures” message


zenspider
2017-8-14 20:34:03

OK. so I’m still responsible for my own failure/error reporting… gotcha


zenspider
2017-8-14 20:34:19

grr… I need to STOP thinking about porting minitest. no no no … I don’t need another project


zenspider
2017-8-14 20:41:32

looks like i should poke at current-check-around to make inner failures opaque to the test runner


zenspider
2017-8-14 20:45:22

heh. I DO use that already… so no…


zenspider
2017-8-14 21:11:57

ok…. so check-log! is called inside of functions like fail-check and the like… THEN they raise exceptions for things like current-check-around to deal with… which doesn’t make much sense to me. I should be allowed to use parameterize to completely override how a test gets run/accounted-for.


lexi.lambda
2017-8-14 21:13:06

that sounds like probably the wrong thing, yes


lexi.lambda
2017-8-14 21:13:14

I imagine you could submit a PR to fix that and it would be accepted


zenspider
2017-8-14 21:14:11

it’s a bit of a tangle… I need to wrap my head around it but at least I have a simple test case to reproduce it


zenspider
2017-8-14 21:15:25

or … parameterize test-log! ?


zenspider
2017-8-14 21:15:48

that seems easier for sure… but… maybe less correct?


zenspider
2017-8-14 21:16:20

@notjack ^^^ opinions?


notjack
2017-8-14 21:33:53

@zenspider oh jeez I missed all of this conversation and it’s so useful. Will respond when back at desk


notjack
2017-8-14 21:37:30

@zenspider re composable assertions: yes! those would be very useful. so useful, that I’ve been working on a package that provides them: http://docs.racket-lang.org/expect/


notjack
2017-8-14 21:38:08

they’re not yet ready for prime time, but if you’d like to help it’d be very appreciated. the github repo has a lot of open issues documenting stuff I plan to add: https://github.com/jackfirth/racket-expect/issues


notjack
2017-8-14 21:39:38

as for the test-log! weirdness: yes, ideally, test-log! would only occur in current-check-around. That’s something I’d like to fix in rackunit but it might break things in strange places. I’m particularly concerned about how that interacts with the test-case / test-suite macros, since they parameterize current-check-around. Personally I think that in a test case or suite the entire case or suite should count as a single test.


notjack
2017-8-14 21:40:08

oh, and I’ve been looking at minitest’s features for inspiration on perf testing too so thanks :)


notjack
2017-8-14 21:53:16

zenspider
2017-8-14 21:55:33

saw that! cool thanks!


zenspider
2017-8-14 21:55:46

@notjack what’s your opinion on parameterizing test-log! ?


notjack
2017-8-14 21:56:55

@zenspider it’s provided as a simple low-level workaround to unblock people who need to extend rackunit or reflect over checks without all their legacy weirdness breaking them


notjack
2017-8-14 21:57:35

so if it works feel no shame in using it, but if there’s no other option that’s probably because something isn’t designed well and a bug to fix that would be welcome


zenspider
2017-8-14 21:57:59

??? I’m not tracking… are you saying it already IS parameterized?


notjack
2017-8-14 21:58:22

oh! yeah I added a parameter to disable the log in the most recent racket release


notjack
2017-8-14 21:58:34

test-log-enabled?



zenspider
2017-8-14 21:59:06

oh shit… I missed the last release. :stuck_out_tongue:


zenspider
2017-8-14 21:59:17

this should fix me right up then…


notjack
2017-8-14 22:01:32

glad to help :)


notjack
2017-8-14 23:36:28

Are #:transparent structs supposed to be allowed as place messages? The docs for places in general say “To a first approximation, place channels support only immutable, transparent values as messages” but the docs for place-message-allowed? say “pairs, lists, vectors, and immutable prefab structures containing message-allowed values, where a mutable vector is automatically replaced by an immutable vector” are allowed and make no mention of transparent structures. Attempting to send a transparent struct raises an error.


lexi.lambda
2017-8-14 23:40:18

My guess is that the meaning of “transparent” there is not intended to mean “transparent structure”, but I think the wording could be improved.


mflatt
2017-8-14 23:40:58

@notjack #:transparent structs are not meant to be allowed as place messages


notjack
2017-8-14 23:41:30

ah, a doc improvement would be welcome then


zenspider
2017-8-14 23:54:34

@notjack are there differences in the failure message output in the new release?


notjack
2017-8-14 23:55:02

@zenspider slight differences, yes


notjack
2017-8-14 23:55:05

why do you ask?


zenspider
2017-8-14 23:55:47

I have new failures in my test suite… just making sure. I’d rather update my expected to match the latest version rather than trying to find some way to normalize it at this point


notjack
2017-8-14 23:57:03

@zenspider you might be interested in https://github.com/racket/rackunit/pull/59 which attempts to add some helpers for testing custom checks without everything breaking every time the message format changes slightly


zenspider
2017-8-14 23:57:17

cool. thanks


zenspider
2017-8-14 23:58:38

that’s slated for 6.11 I assume?


notjack
2017-8-14 23:59:22

ya, although I haven’t gotten around to resolving the API issues yet


zenspider
2017-8-15 00:09:13

@notjack is pretty-info (or accessors) exported? seems like not


zenspider
2017-8-15 00:09:25

I’m failing because (pretty-info x) vs x


notjack
2017-8-15 00:11:03

It’s not. pretty-info, verbose-info and location-info were created when refactoring some internal rackunit code implementing run-tests. If you need them (or your test is failing because you’re calling check-equal? on the info struct) they can be exported.


notjack
2017-8-15 00:11:25

you could also use make-check-expected / make-check-actual, since those add pretty-info under the hood


zenspider
2017-8-15 00:11:35

I just required rackunit/private/check-info and am back on track


notjack
2017-8-15 00:12:20

that works, although I think using make-check-expected or make-check-actual might also work without you needing to require any private modules


zenspider
2017-8-15 00:13:50

one thing at a time :slightly_smiling_face:


zenspider
2017-8-15 00:22:50

@notjack hrm… maybe I’ll need to do that sooner rather than later:

(exn-message (with-handlers ([exn:test:check? identity])
               (parameterize ([current-check-around (λ (f) (f))])
                 (check-equal? 1 2 "a message"))))

notjack
2017-8-15 00:24:39

@zenspider do what?


zenspider
2017-8-15 00:25:50

hrm… actually I’m confused by 2 things… 1) the above snippet doesn’t result in "a message"


zenspider
2017-8-15 00:26:11

2) make-check-expected and make-check-actual wrap up in structs that can’t be compared


zenspider
2017-8-15 00:26:29
(check-equal? (make-check-expected 42) (make-check-actual 42))

zenspider
2017-8-15 00:27:58

totally open to changing my code around to fit a better strategy…


notjack
2017-8-15 00:28:57

The message you pass to a check is stored as a check info with key 'message unfortunately, it doesn’t control the message of the exception directly


notjack
2017-8-15 00:29:21

(personally I think the message argument just shouldn’t be used)


zenspider
2017-8-15 00:30:08

hrm… ok. It used to be “Check failure” ? … those are two different messages tho?


notjack
2017-8-15 00:31:35

Yeah there’s two. The default message used to be “check failure” but now it’s nothing. Unless the check passes a string to fail-check there won’t be a message on its own line. The message argument at check use sites always added an info, it’s unrelated to the “Check failure” line


zenspider
2017-8-15 00:32:02

yeah. I was testing that because my previous version relayed everything via fail-check


zenspider
2017-8-15 00:32:12

and now uses check-info


notjack
2017-8-15 00:32:59

fail-check is the preferred way for a textual message for the user, info is best for structured values


zenspider
2017-8-15 00:35:16

well… this is both :slightly_smiling_face:


zenspider
2017-8-15 00:35:31

ok. I think I have things fixed in a way I like…


zenspider
2017-8-15 00:35:44

do I need to bump the package system or will it pick it up automatically?


notjack
2017-8-15 00:36:33

I don’t think you need to bump it, the catalog points to your git head and the build server will build the latest every night


zenspider
2017-8-15 00:36:56

I updated the description anyways…. maybe that’ll trigger something


zenspider
2017-8-15 00:37:30

and apparently I never released benchmark-ips… I should get on that



zenspider
2017-8-15 00:41:35

I love this package… use it all the time to compare approaches