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

Dump with filtered operators #539

Open
jmafoster1 opened this issue Aug 3, 2023 · 0 comments
Open

Dump with filtered operators #539

jmafoster1 opened this issue Aug 3, 2023 · 0 comments

Comments

@jmafoster1
Copy link

Summary

Dumping a database with filtered operators gives AttributeError: 'NoneType' object has no attribute 'value' because skipped jobs have no test outcome.

Steps to reproduce

  1. Create file ROOT/mod.py with content
def func():
    return 1233 + 1
  1. Create file ROOT/test_mod.py with content
import unittest
import mod

class Tests(unittest.TestCase):
    def test_func(self):
        self.assertEqual(mod.func(), 1234)
  1. Create file ROOT/tutorial.toml with content
[cosmic-ray]
module-path = "mod.py"
timeout = 10.0
excluded-modules = []
test-command = "python -m unittest test_mod.py"

[cosmic-ray.distributor]
name = "local"

[cosmic-ray.filters.operators-filter]
exclude-operators = [
  "core/NumberReplacer"
]
  1. Run cosmic-ray init tutorial.toml tutorial.sqlite
  2. Run cr-filter-operators tutorial.sqlite tutorial.toml
  3. Run cosmic-ray exec tutorial.toml tutorial.sqlite
  4. Run cosmic-ray dump tutorial.sqlite
  5. Observe error
cosmic_ray/cli.py", line 192, in result_to_dict
    d["test_outcome"] = d["test_outcome"].value
AttributeError: 'NoneType' object has no attribute 'value'

The problem comes about because the filtered jobs are skipped, so have no test_outcome. This could probably be fixed with a simple if statement in the line above to test whether d["test_outcome"] is not None before trying to access the value, although that might then pass the problem further down the line.

A fix is not a particularly high priority for me, but I thought I'd report the issue, and would be happy to attempt a pull request if that's something you're interested in.

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

No branches or pull requests

1 participant