From the root of my project I am running the standard python unit-testing command.
python3 -m unittest
I end up with
doc = yaml.safe_load(f)
NameError: name 'yaml' is not defined
Here's a blueprint of the test code:
import unittest
import yaml
from validators.utils import get_settings_key
# from validators.validators import validate_assumed_role
class TestValidators(unittest.TestCase):
def setUp(self):
with open("boilerplate_aws.yaml") as f:
self.doc = yaml.safe_load(f)
self.infrastructure = self.doc["parameters"]["infrastructure"]
self.inventory_role = self.infrastructure["assumed_role_arn"]
def test_role_validator(self):
settings_role = get_settings_key("assumed_role_arn")
# self.assertTrue(validate_assumed_role(self.inventory_role, settings_role))
#
if __name__ == '__main__':
unittest.main()
I consider the yaml module as a global one coming by default in Python. Just wondering if I am missing something or it's some project messed up structure ? Just for safety check, I looked up the package and it's here locally. This is under Ubuntu. No venvs, or anything like that.
Thanks.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…