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

Props blacklist #753

Merged
merged 8 commits into from
May 30, 2019
23 changes: 8 additions & 15 deletions tests/unit/dash/development/test_base_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
js_to_py_type
)

_dir = os.path.dirname(os.path.abspath(__file__))

Component._prop_names = ('id', 'a', 'children', 'style', )
Component._type = 'TestComponent'
Component._namespace = 'test_namespace'
Expand Down Expand Up @@ -487,8 +489,7 @@ def test_iter(self):

class TestGenerateClassFile(unittest.TestCase):
def setUp(self):
json_path = os.path.join(
'tests', 'unit', 'dash', 'development', 'metadata_test.json')
json_path = os.path.join(_dir, 'metadata_test.json')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So that you can run the tests from any working directory, not just the repo root.

with open(json_path) as data_file:
json_string = data_file.read()
data = json\
Expand Down Expand Up @@ -527,9 +528,7 @@ def setUp(self):
self.written_class_string = f.read()

# The expected result for both class string and class file generation
expected_string_path = os.path.join(
'tests', 'unit', 'dash', 'development', 'metadata_test.py'
)
expected_string_path = os.path.join(_dir, 'metadata_test.py')
with open(expected_string_path, 'r') as f:
self.expected_class_string = f.read()

Expand Down Expand Up @@ -557,8 +556,7 @@ def test_class_file(self):

class TestGenerateClass(unittest.TestCase):
def setUp(self):
path = os.path.join(
'tests', 'unit', 'dash', 'development', 'metadata_test.json')
path = os.path.join(_dir, 'metadata_test.json')
with open(path) as data_file:
json_string = data_file.read()
data = json\
Expand All @@ -573,10 +571,7 @@ def setUp(self):
namespace='TableComponents'
)

path = os.path.join(
'tests', 'unit', 'dash', 'development',
'metadata_required_test.json'
)
path = os.path.join(_dir, 'metadata_required_test.json')
with open(path) as data_file:
json_string = data_file.read()
required_data = json\
Expand Down Expand Up @@ -746,8 +741,7 @@ def test_required_props(self):

class TestMetaDataConversions(unittest.TestCase):
def setUp(self):
path = os.path.join(
'tests', 'unit', 'dash', 'development', 'metadata_test.json')
path = os.path.join(_dir, 'metadata_test.json')
with open(path) as data_file:
json_string = data_file.read()
data = json\
Expand Down Expand Up @@ -930,8 +924,7 @@ def assert_docstring(assertEqual, docstring):

class TestFlowMetaDataConversions(unittest.TestCase):
def setUp(self):
path = os.path.join(
'tests', 'unit', 'dash', 'development', 'flow_metadata_test.json')
path = os.path.join(_dir, 'flow_metadata_test.json')
with open(path) as data_file:
json_string = data_file.read()
data = json\
Expand Down