Skip to content

Update testing intro doc #4735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

mwichmann
Copy link
Collaborator

This does not affect SCons at all - only updates the document (which is eventually duplicated on the Wiki) about making use of the SCons test framework.

It's not going to be easy to review in the classical way, maybe just scan through the full doc and see if it makes sense this way?

https://scons.org/guidelines.html

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt and RELEASE.txt (and read the README.rst).
  • I have updated the appropriate documentation

@mwichmann mwichmann added the testsuite Things that only affect the SCons testing. Do not use just because a PR has tests. label Jun 10, 2025
the unit tests for the ``Builder.py`` module are in the
``BuilderTests.py`` script. Unit tests tend to be based on assertions.
``SCons/`` subdirectory (that is alongside the code they are testing)
and use the Python ``unittest`` module to perform assertion-based
Copy link
Contributor

Choose a reason for hiding this comment

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

Should include that files have to be named *Tests.py to be found.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought that's what that section was saying?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see it in this section.. it's much later in the doc..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not seeing the reason for the fuss here. This is an "about" section, not a "how to" section. I can add these but it seems like extra noise.

Copy link
Contributor

Choose a reason for hiding this comment

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

You removed it from the original, which I think is useful information to have up front.

run by calling ``scons`` (or in a few cases, ``sconsign`` or ``scons-time``)
to execute them, and thus capture the results of
running all the way through an invocation - end to end.
They are implemented as Python scripts which are responsible for setup,
Copy link
Contributor

Choose a reason for hiding this comment

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

Must have the .py suffix.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It says that clearly somewhere... line 112 in the current copy after I hunt for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

better to duplicate than to mention this bit here and that bit only later.

a reproducer are by their nature more like an e2e test - this is something
a user has tried in their SConscripts that didn't have the expected result.
End-to-end tests exist to verify hardened parts of the public interface:
featurers documented in the reference manual that are available
Copy link
Contributor

Choose a reason for hiding this comment

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

typo "featurers" -> features.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixing.

("I put this in my SConscripts, and something went wrong"),
so it's often useful to code an e2e test to match a bug report,
and develop a solution that turns that to a pass.
So pick the testing strategy that makes sense (sometimes both do).
Copy link
Contributor

Choose a reason for hiding this comment

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

And if it's possible to reduce an end-to-end test to a unit test, please do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll add that but I'm not sure that's always the preference, I think it's context-dependent.



Testing Architecture
====================

The test framework provides a lot of useful functions for use within a
test program. This includes test setup, parameterization, running tests,
looking at results and reporting outcomes. You can run a particular test
examining results and reporting outcomes. You can run a particular test
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this work for end-to-end tests? I thought it was only unit tests..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right, it doesn't - I thought it did. It doesn't find the SCons instance properly. Possible that could be fiddled too, but I'll get rid of the implication.

tells ``runtest.py`` to skip the contents of the directory completely.
#. Create a file ``.exclude_tests`` in each directory in question, and in
it list line-by-line the files to exclude from testing.
* Create a file ``.exclude_tests`` in yur subdirectory, and in
Copy link
Contributor

Choose a reason for hiding this comment

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

yur => your

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

or "ur"? :-)

Sometimes other Python modules are necessary or helpful, and get
imported before this line.
If you need Python standard library modules in your code,
the conventio it to import those before the framework.
Copy link
Contributor

Choose a reason for hiding this comment

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

conventio -> convention

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testsuite Things that only affect the SCons testing. Do not use just because a PR has tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants