Skip to content

Add test for semantics#31

Open
kevalnagda wants to merge 3 commits intosimple-framework:masterfrom
kevalnagda:master
Open

Add test for semantics#31
kevalnagda wants to merge 3 commits intosimple-framework:masterfrom
kevalnagda:master

Conversation

@kevalnagda
Copy link

Hey @maany I've added a YAML syntax validation rule. Please take a look. Thanks!

requirements.txt Outdated
ruamel.ordereddict==0.4.13
ruamel.yaml==0.15.71
argparse==1.4.0 No newline at end of file
argparse==1.4.0yamllint==1.15.0 No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Could you move yamllint to a new line?

from yamllint.config import YamlLintConfig
from yamllint import linter

class MyTest(unittest.TestCase):
Copy link
Member

Choose a reason for hiding this comment

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

@pumpkinman008 , Could you rename the class to TestSemantics


self.assertEqual(input, input) No newline at end of file
def test_check_yaml_syntax(self):
augmented_yaml_file = check_yaml_syntax('./data/runtime.yaml')
Copy link
Member

Choose a reason for hiding this comment

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

@pumpkinman008 the function check_yaml_syntax takes a file object at input

Copy link
Member

Choose a reason for hiding this comment

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

Also, the tests on the CI will be run from the root directory of the project. Can you change the path to ./tests/data/runtime.yaml.
Also, before the next PR, could you run

python -m unittest discover 

from the root directory of the project and resolve any errors.

self.assertEqual(input, input) No newline at end of file
def test_check_yaml_syntax(self):
augmented_yaml_file = check_yaml_syntax('./data/runtime.yaml')
file = open(augmented_yaml_file)
Copy link
Member

Choose a reason for hiding this comment

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

I get errors when running this line. The check_yaml_syntax function also returns a file object at output, try passing augmented_yaml_file.name to open().

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.

2 participants