Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sdks/python/apache_beam/yaml/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@ def test_jinja_datetime(self):
fin.read().strip(), datetime.datetime.now().strftime("%Y-%m-%d"))

def test_inline_test_specs(self):
main.run_tests(['--yaml_pipeline', TEST_PIPELINE, '--test'], exit=False)
for flag in ['--tests', '--test']:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we have 2 different ways of doing this? Could you add some context?

@derrickaw derrickaw Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

  1. Originally --test was added.
  2. Then docs were added stating --tests was to be used.
  3. Another person added --tests and kept the backward compatible --test.
  4. This PR completes the cycle with improved testing for both flags and update documentation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok - I think the alias is fine (it probably would've been better to just update the docs, but that ship has sailed). But instead of alluding to both in our docs, lets just pick one and make sure all of our docs use that. I don't care which one we choose, but I think mentioning both (or switching back and forth) will just confuse users and lead them to wonder which one they should choose.

Keeping the main_test.py change is fine

@derrickaw derrickaw Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok removed the --test change. Thanks

known_args, pipeline_args = main._parse_arguments(
['--yaml_pipeline', TEST_PIPELINE, flag])
self.assertTrue(known_args.tests)
self.assertEqual(pipeline_args, [])
main.run_tests(['--yaml_pipeline', TEST_PIPELINE, flag], exit=False)

def test_external_test_specs(self):
with tempfile.TemporaryDirectory() as tmpdir:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ Neither the actual Read transform nor Write transform from the original
pipelines are executed when running the test, but all intermediate transforms
are.

This test can then be executed by running
This test can then be executed with the `--tests` flag by running

```
python -m apache_beam.yaml.main \
--yaml_pipeline_file=wordcount.yaml \
--tests
```

Alternatively, the a `tests:` block may be placed in a separate file and be
Alternatively, a `tests:` block may be placed in a separate file and be
validated by running

```
Expand Down Expand Up @@ -279,7 +279,7 @@ tests:
- name: Upper
elements: [element: A, element: Z]

- name: TestMultipelOuptuts
- name: TestMultipleOutputs
mock_inputs:
- name: Upper
elements: [element: m, element: nnn]
Expand Down
Loading