Skip to content
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

Run real worlds projects tests with cmd line tool #147

Merged
merged 10 commits into from
Feb 16, 2023

Conversation

mknorps
Copy link
Collaborator

@mknorps mknorps commented Feb 14, 2023

Change in testing real projects that prepare the ground for testing dependency to import mapping.
This is a result of a very productive pair programming session of @jherland and mine.

The major change is that we no longer test using Analysis object, but running fawltydeps command with json output. (As we can see machines are already happy to be able to read FD output 🤖 ). Simplified version of run_fawltydeps (first added to test_cmdline.py) creates a subprocess that runs fawltydeps command and collects the output.

The term "experiment" used later, refers to one run of fawltydeps with given command line arguments on a real-world project.

Additional changes:

  • format of *.toml files of real projects is changed to contain more than one experiment. All experiments are under experiments keyword, and for example
    [experiments.all]
    
    is an experiment named all.
  • Within a single experiment, which has a matching type Experiment, we have command-line arguments (args) and results of the experiment matching the Analysis results.
  • Experiment object contains a verify_analysis_json method that does all comparison of the current experiment (self) and a given analysis.
  • Pytest parameterization is done per experiment and not per project.

mknorps and others added 3 commits February 14, 2023 13:48
instead of using Analysis object

Refactor toml schema of r-w projects

to account for different experiments that

may be conducted with FawltyDeps
@mknorps mknorps changed the title Run real worlds projects tests with cmd line tool WIP Run real worlds projects tests with cmd line tool Feb 14, 2023
The if-condition that checks if a section should be verified must be
compared against None. Consider:

  if self.imports:

will fail if the imports field is missing from the TOML (as intended),
but it will _also_ fail when the imports field is assigned an empty list
(imports = []). The correct if-condition should be:

  if self.imports is not None:

Same for the three other sections.

Prefix relevant prints with the new experiment name, and also print when
we are _skipping_ the verification of a section in the analysis.
@mknorps mknorps changed the title WIP Run real worlds projects tests with cmd line tool Run real worlds projects tests with cmd line tool Feb 14, 2023
@mknorps mknorps requested review from vreuter and Nour-Mws and removed request for vreuter February 14, 2023 21:52
@vreuter
Copy link
Contributor

vreuter commented Feb 15, 2023

Pytest parameterization is done per experiment and not per project.

Wow, AWESOME!!

tests/real_projects/detect-waste.toml Outdated Show resolved Hide resolved
tests/real_projects/detect-waste.toml Outdated Show resolved Hide resolved
tests/real_projects/detect-waste.toml Outdated Show resolved Hide resolved
tests/real_projects/left-pad.toml Outdated Show resolved Hide resolved
tests/real_projects/left-pad.toml Outdated Show resolved Hide resolved
tests/test_real_projects.py Show resolved Hide resolved
tests/test_real_projects.py Outdated Show resolved Hide resolved
tests/test_real_projects.py Show resolved Hide resolved
tests/test_real_projects.py Outdated Show resolved Hide resolved
tests/test_real_projects.py Outdated Show resolved Hide resolved
@mknorps mknorps force-pushed the run-real-worlds-projects-tests-with-cmd-line-tool branch from 8926568 to dde8f36 Compare February 15, 2023 14:20
@mknorps mknorps force-pushed the run-real-worlds-projects-tests-with-cmd-line-tool branch from d181989 to 0cb67de Compare February 15, 2023 14:54
Copy link
Collaborator

@Nour-Mws Nour-Mws left a comment

Choose a reason for hiding this comment

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

That's a herculean effort. Well done!

tests/test_real_projects.py Show resolved Hide resolved
@vreuter vreuter self-requested a review February 16, 2023 09:26
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.

4 participants