Bug introduced in V11.2 or earlier and persisting through V11.3


Some of notebook types generate notebooks with TaggingRules for their purposes:

Rest @ NotebookGet @ CreateNotebook["SlideShow"]
Notebook[..., TaggingRules -> {"SlideShow" -> True}, ...]


But "Testing" notebook gets all you have there:

Rest @ NotebookGet @ CreateNotebook["Testing"]

enter image description here

It is not acceptable. The reason is probably that Notebook's TaggingRules inherit too much and not keeping it it mind.

Obvious fix problem

Using workaround from linked topic, one could try to nb = CreateDocument[{}, TaggingRules -> {}] and then convert it CreateNotebook["Testing", nb], but

CreateNotebook::noconv: Converting ... to type Testing is not supported yet.


I have no doubts it is a bug, how to overcome this and create a clean testing notebook programmatically?


1 Answer 1


The fix is to realize which TaggingRule testing notebook cares about and overwrite all with this one:

nb = CreateNotebook["Testing"];
SetOptions[nb, TaggingRules -> {"$testsRun" -> False}];
Rest @ NotebookGet @ nb

My final goal was to export a testing notebook without prompting a visible notebook. Unfortunately CreateNotebook does not accept options :). So maybe someone will find this code useful:

  , Notebook[{}
      (*first two options are not related to the problem but are Git firendly :) *)
    , "TrackCellChangeTimes" -> False
    , PrivateNotebookOptions -> {"FileOutlineCache" -> False}
    , TaggingRules ->  {"$testsRun" -> False}
    , StyleDefinitions -> FrontEnd`FileName[{"MUnit"},"MUnit.nb",CharacterEncoding->"UTF-8"]
  • 1
    $\begingroup$ CreateNotebook should take options (and for "Template" it's happy to use Visible->False). Unfortunately the "Testing" notebook seems to be all kinds of messed up. $\endgroup$
    – b3m2a1
    May 30, 2018 at 4:14
  • 1
    $\begingroup$ Turns out that's because it just calls MUnit`PaletteNewTestNotebook[] which doesn't take options, but which does set the stylesheet to be FrontEnd`FileName[{"MUnit"}, "MUnit.nb"]. The TaggingRules are actually just inserted by: FrontEndResource["MUnitExpressions", "MUnitStaticToolbar"]. $\endgroup$
    – b3m2a1
    May 30, 2018 at 4:20
  • $\begingroup$ @b3m2a1 thanks, I was sure that the documentation is silent about options but it actually allows them. Another bug to the bucket -.- $\endgroup$
    – Kuba
    May 30, 2018 at 6:27
  • $\begingroup$ Yeah it feels these days like a lot of the front-end development is as rushed as what I do... Hopefully that means it's all going into a new stunning 64 bit FE. $\endgroup$
    – b3m2a1
    May 30, 2018 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.