Update the unit tests to use a full PG environment#726
Merged
Conversation
Member
Author
|
Also note that this pull request is included in #724. |
Member
|
Want to point out that if your external programs are not the defaults in |
Member
Author
|
Yeah, the pg_config.dist.yml will need to be set correctly for your system for the new tikz test to work. Unfortunately, I don't think there is any way around that. |
482cf5e to
0926355
Compare
0926355 to
8dc909b
Compare
1eda900 to
4199579
Compare
Remove the ALWAYS_SHOW_HINT_PERMISSION_LEVEL and ALWAYS_SHOW_SOLUTION_PERMISSION_LEVEL settings. Whether hints and solutions are shown is now determined by the front end. The pg flag/variable $showHint has been removed. The front end has complete control on when hints are shown. Not the problem author. Also the options to use knowls for solutions and hints have been removed. Always use knowls for solutions and hints. Showing the various pieces of debugging information for a problem is now controlled with translation options. The front end is responsible for converting permissions into these debugging options. The VIEW_PROBLEM_DEBUGGING_INFO special pg environment variable was removed and is one of these debugging options. Many unnecessary PG environment variables have been removed. One of these is the session key. Remove reduced scoring entirely from PG. That is the responsibility of the front end to implement. Pg now has not dates and and no permissions. The color.c file has been removed. The method in that file has been reimplemented in Chromatic.pm using perl. It is perhaps a bit slower, but not significantly in the scope of rendering a problem. This can be tested with the problems Library/NAU/setGraphTheory/FindChromaticNumber.pg, Library/NAU/setGraphTheory/FindRoomColor.pg, and Library/NAU/setGraphTheory/RoomSchedule.pg which happen to be all known problems that use the Chromatic module. The image generator has been rewritten to remove the dvipng_align hack and to allow the usage of sqlite for a database backend for storing dvipng depths. Note that PGalias no longer uses the course name, user login, set number, and problem number for generating resource UUID's. It now only uses the problem seed, psvn, and problemUUID. It is the caller's responsibility of ensuring that problemUUID guarantees the necessary uniqueness.
The t/macros/load_macros.t file tests that all macros load without errors or warnings. There is one macro that will not work in this test and it is skipped. That is the answerDiscussion.pl macro. It requires a file that is not part of the PG distribution. It also has invalid `defined(@array)` calls. Warnings found in other macro files were fixed. The PG_module_list.pl macro was deleted. That is clearly obsolete and will not work. There are also some tests added in t/pg_problems that test that rendering with the WeBWorK::PG module works and demonstrate how to use it in unit tests.
AppletObjects.pl macro caused by extending the Applet package in the macro. Instead of extending the Applet package, a derived package (PGApplet) is created and used in the macro. The GeogebraWebApplet package needs to derive from the PGApplet package, and so it needs to be moved to the macro. Also, the Applet.pm package no longer derives from the PGcore package. It doesn't need to as it uses none of the PGcore module methods.
The server really should not be checking urls in this way. If an invalid url is given, let the error come out in the browser. This is the correct way to deal with this.
Many subroutines are redefined in macros. In addition if multiple WeBWorK::PG::Translator instances are created in the same process, the safe compartment is not entirely isolated between instances, and this causes redefine warnings if a macro is loaded in both instances. This is due to a memory leak somewhere and needs to be fixed.
back to the original file in which the error occurred.
Squashed commits after messing up the rebase onto the latest develop branch.
Recreated and these are the commit messages rescued from that.
tableau.t
PITA! The circular references in MathObjects made
the deep comparisons impossible, so all MathObjects
were stringified for comparisons.
WARN and DEBUG message sub redefinitions were removed.
A "validator" and a stringify sub were added to get around
some of the comparison issues.
Organized into subtests.
math_objects_basics.t
Convert `throws_ok` to the like/dies construct
and the tests pass.
Arranged sections in subtests
Three test files migrated from Test::More to Test2 without modification
(other than moving the environment setup from the script to Test::PG)
This expands on the original t/README.md on the details of testing.
t/context
Minor changes to migrate tests in t/context from Test::More to Test2
There were few tests in these files.
toltype_digits.t organized into subtests by topic
Use the Test::PG environment with Test2
Find that the original test produced unexpected results
and the tests that expose the incorrect behaviour have
been wrapped in a TODO block
Added unit tests for Units.pm
Tests to validate the correctness of openwebwork#677
Unit tests for Units.pm electron volts
Tests for parserNumberWithUnits.pl with basic energy conversions
Adding a Test::PG module in t/lib/ to take the place of t/build_PG_envir.pl
Convert math_objects/factorial.t to using the Test2 framework Update the t/README.md to the new usage of Test2 and the boilerplate Test::PG module removed the execute permission from tableau.t
…nment method to create a complete environment for tests.
4199579 to
66952a4
Compare
drdrew42
approved these changes
Oct 12, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This builds on #709 and #702. Since my reviews on #702 have not received any attention, consider this a replacement of that pull request. The commits from that pull request are contained in this one.
The main thing this does is improves the
t/build_PG_envir.plfile to use the PG environment from #709 to create a complete translator environment for use in the unit tests. All of that will be needed for unit tests to properly work.Also a unit test for testing the PGtikz.pl macro is added.