Skip to content

Fixing anti-patterns (cherry picks from PR 1039)#1069

Merged
squirrelsc merged 16 commits into
mainfrom
chisong/v3_pr_1039_picks
Oct 27, 2020
Merged

Fixing anti-patterns (cherry picks from PR 1039)#1069
squirrelsc merged 16 commits into
mainfrom
chisong/v3_pr_1039_picks

Conversation

@squirrelsc
Copy link
Copy Markdown
Contributor

@squirrelsc squirrelsc commented Oct 26, 2020

Cherry pick changes from #1039 , and some improvements.

  1. Refer to Fixing anti-patterns #1039 , mainly two changes are not included, 1) remove action, which use to provide global processing information, 2) change suite/case, which are well known concepts, to case/test concepts.
  2. Remove module level variables in test_platform, which blocks rename test_runner.
  3. Other improvements, which found in e2e testing.

@squirrelsc squirrelsc added the 🆕 LISAv3 Incubation work for the next version of LISA label Oct 26, 2020
@squirrelsc squirrelsc mentioned this pull request Oct 26, 2020
andyleejordan and others added 16 commits October 26, 2020 12:50
The `-X dev` option reveals useful information such as leaked system
resources.
At minimum this converts the usage to the documented approach where this
is exactly one asyncio event loop (started in main) and everything that
currently is written async actually becomes a coroutine.

The unit tests which use coroutines now use `IsolatedAsyncioTestCase`
instead of just `TestCase`, which ensures they continue to work.
Instead of aliasing this function, we should just rename it entirely.

Instead of delegating the parsing of an `argparse.Namespace` object, we
just setup the `runbook` argument to be a `Path` instead of a string,
and have `load_runbook` accept what it needs instead of digging it out
of the `Namespace`.
And use single underscore to avoid invoking name mangling. If the name
is reused in a subclass, we likely do not intend to have a duplicate
variable, but are intending to use it. For variables we expect to be
used, we should use Python’s built-in `property` class/decorator.

Co-Authored-By: Andy Schwartzmeyer <andrew@schwartzmeyer.com>
Module variables are not recommend, and it brings problems in ut.
Refine code to avoid use it.
Co-Authored-By: Andy Schwartzmeyer <andrew@schwartzmeyer.com>
Since it’s really just a list comprehension. Also add a bunch of notes
identifying things to investigate further.
There’s more work to do because this was using duck typing. It’s a
little better now, but it’s just a massive wrapper for a library that’s
just another wrapper for Python’s actual APIs (which are just wrappers
for the system’s APIs).
Co-authored-by: Chi Song <27178119+squirrelsc@users.noreply.github.com>
`LisaTestCase` is _not_ an abstract base class, it’s just a base
class (with a lot of implementation) and defines no abstract methods. So
we remove this.
@squirrelsc squirrelsc force-pushed the chisong/v3_pr_1039_picks branch from 2c4434d to b536d96 Compare October 26, 2020 04:57
@squirrelsc squirrelsc merged commit 6d2b5a5 into main Oct 27, 2020
@squirrelsc squirrelsc deleted the chisong/v3_pr_1039_picks branch October 27, 2020 06:00
@squirrelsc
Copy link
Copy Markdown
Contributor Author

merge due to timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 LISAv3 Incubation work for the next version of LISA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants