Subcommand help #3956
Conversation
| class TestUnknownCommandHelp(TestDvc): | ||
| def test(self): | ||
| with io.StringIO() as buf, redirect_stdout(buf): | ||
| try: | ||
| _ = parse_args(["unknown"]) | ||
| except DvcParserError: | ||
| pass | ||
| output = buf.getvalue() | ||
| with io.StringIO() as buf, redirect_stdout(buf): | ||
| try: | ||
| _ = parse_args(["--help"]) | ||
| except SystemExit: | ||
| pass | ||
| help_out = buf.getvalue() | ||
| self.assertEqual(output, help_out) |
There was a problem hiding this comment.
Could you please convert these tests to pytest-style? We are moving away from unittest to pytest these days, and all new tests are prefered to be in pytest. Sorry for the confusion :(
There was a problem hiding this comment.
@efiop, Should I use dvc fixture from tests/dir_helpers instead of TestDvc class? Or something else?
There was a problem hiding this comment.
@aerubanov Yes, that's the one. But actually, you might not need any dvc fixtures at all. Right now I'm not seeing anything that needs dvc-repo. E.g. see tests/unit/command/test_get.py.
| except DvcParserError: | ||
| pass | ||
| output = buf.getvalue() | ||
| with io.StringIO() as buf, redirect_stdout(buf): |
There was a problem hiding this comment.
Should be able to use capsys in pytest-style test.
efiop
left a comment
There was a problem hiding this comment.
Thank you so much @aerubanov ! Please see a few comments above.
* remote: move upload()/download() into tree * remote: move path_info/path_cls into tree * remote.azure: finish moving methods into tree * remote.gs: finish moving methods into tree * remote.hdfs: finish moving methods to tree * remote.http: finish moving methods into tree * remote.oss: finish moving methods into tree * remote.s3: finish moving methods into tree * remote.ssh: finish moving methods into tree * remote.gdrive: finish moving methods into tree * tests: update remote unit tests * tests: update func tests * remote: use walk_files() for all remotes * list_cache_paths() now uses tree.walk_files() for all remotes except local/ssh * fix DS warnings * bugfixes
* run: disable directories for -m/-M flags * run: reformatted string literals * run: simplified metrics check * tests: func: run: dirs as metrics outs * tests: func: run: reformatted string literals * tests: use pytest Co-authored-by: Ruslan Kuprieiev <ruslan@iterative.ai>
* refactor multistage load for params and outputs * tests: load params * tests: output loading from pipeline file * fix test * fix typo in name * split params load * rename params func s/inject_values/fill_values * fix tests * simplify loads_params and output.load_from_pipeline * address @pared's suggestions for tests
* tests: fix gdrive build * remote.gdrive: fix walk_files prefix relpath
|
I changed the tests to pytest-style and removed the getttext. |
Codecov Report
@@ Coverage Diff @@
## master #3956 +/- ##
==========================================
+ Coverage 92.15% 92.24% +0.08%
==========================================
Files 161 161
Lines 11180 11160 -20
==========================================
- Hits 10303 10294 -9
+ Misses 877 866 -11
Continue to review full report at Codecov.
|
|
Thank you @aerubanov ! |
Fixes #2395
❗ I have followed the Contributing to DVC checklist.
📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here. If the CLI API is changed, I have updated tab completion scripts.
❌ I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)
Thank you for the contribution - we'll try to review it as soon as possible. 🙏