Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jsiirola
Copy link
Member

@jsiirola jsiirola commented Jan 9, 2024

Fixes #2547, fixes #1950

Summary/Motivation:

The test driver for exercising the literalinclude examples was broken for many years. This PR refactors the Pyomo Book test driver so that it can be directly re-used for testing the OnlineDocs py files that are literalincluded. These tests are now active and added to the GHA and Jenkins jobs.

As a result, numerous examples and baselines needed to be updated to track changes in core over the last ~6 years. In addition, this does a minor overhaul of the "managing expressions" section to update it to reflect the current implementation.

Changes proposed in this PR:

  • refactor Book test driver to be reusable in other contexts
  • update the OnlineDocs test driver to use the Book test friver
  • update numerous baselines
  • update the documentation in the "Managing expressions" section
  • Add testing of pyomo/doc to GHA and Jenkins drivers

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

filtered = []
deprecated = None
for line in lines:
# Ignore all deprecation warnings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know why we would want to ignore deprecation warnings, but do we really want to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm torn. This was added ages ago so that we didn't have to update Book baselines as frequently. Is it better to keep updating the baselines with the deprecation warning (noting that the baseline would have to be updated twice: once when the deprecation was added, and again after the next release (when the version is updated)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thought for why it's worth the effort is that we become starkly aware of when we are deprecating something that is mentioned in the book. It's one of those "debt vs. clear knowledge" arguments.

@codecov
Copy link

codecov bot commented Jan 10, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (a53bebc) 88.09% compared to head (ba5f5f2) 88.26%.

Files Patch % Lines
doc/OnlineDocs/src/test_examples.py 91.30% 2 Missing ⚠️
pyomo/common/unittest.py 99.44% 1 Missing ⚠️
pyomo/scripting/util.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3080      +/-   ##
==========================================
+ Coverage   88.09%   88.26%   +0.16%     
==========================================
  Files         775      832      +57     
  Lines       91549    92451     +902     
==========================================
+ Hits        80652    81599     +947     
+ Misses      10897    10852      -45     
Flag Coverage Δ
linux 85.50% <96.63%> (+0.04%) ⬆️
osx 75.51% <95.67%> (+0.03%) ⬆️
other 85.68% <96.15%> (+0.04%) ⬆️
win 82.82% <87.98%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, git is showing this as new instead of renamed. I'm confused as to why.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto with this one. Weird.

@@ -33,35 +33,6 @@
print(EXPR.expression_to_string(e, labeler=NumericLabeler('x')))
# @ex2

# ---------------------------------------------
Copy link
Contributor

@mrmundt mrmundt Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - why remove this expression example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ex3: the example won't run: standardize= has not been a valid argument for 6 years.
  • ex4: clone_counter is deprecated (and nonfunctional), so we don't want to continue to advertise it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Our docs are up to date, we swear."

@jsiirola jsiirola merged commit 98537e0 into Pyomo:main Jan 13, 2024
@jsiirola jsiirola deleted the test-onlinedcos-include branch January 13, 2024 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

One test fails: AttributeError: type object 'Test_expr' has no attribute 'add_baseline_test' Fix non-doctest documentation tests

2 participants