-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
<DataNode>.is_up_to_date raises error when never written before #1224
<DataNode>.is_up_to_date raises error when never written before #1224
Conversation
Hello @yaten2302, thank you for your contribution. Can you add a unittest that fails before your fix, and passes after your fix? |
Hey @trgiangdo, actually, I'm not really familiar on how to add tests. Could you please guide that how can I create and add the same? |
@yaten2302 You can take a look at https://github.com/Avaiga/taipy/blob/c3aaf92e767c0844c698701a9c18d15d19bf60ba/tests/core/data/test_data_node.py. Basically, the test should:
|
Do I've to do like this? In this file: https://github.com/Avaiga/taipy/blob/c3aaf92e767c0844c698701a9c18d15d19bf60ba/tests/core/data/test_data_node.py class TestData:
def testDataNode:
dn = InMemoryDataNode("dn", Scope.SCENARIO)
assert dn.is_up_to_date == False |
Yes, and you can also try to write to the data node, then |
Thanks, @trgiangdo. I'll make the changes by today. Also, could you please tell that if we want to test the changes, then do we've to run the command - |
Hey @trgiangdo, I've put this code in the file tests/core/data/test_data_node.py. After that when I run the |
Seems like the modification you made causes the The reason should be shown the terminal when you run the test. You can run the specific test by running the |
@trgiangdo, when I'm running the command |
You are not in the virtualenv. Please run pytest with the "pipenv run ..." or activate the virtualenv |
It's again showing the same error @trgiangdo |
It's because you are running the pipenv command in a different directory. You need to cd back to the taipy folder where you created the previous virtualenv and run the test |
@trgiangdo, but when I'm running this command in the |
It's because the path you provided after the |
Yes, now it's working 👍 @trgiangdo. It's showing error in 2 functions - |
You modified the |
Yes, @trgiangdo , what my test does is that it'll return False if the data node is not written. |
Then why are you testing if it is up to date with the |
I've added the data node in the test, but it's showing the error(ss I've sent in the above comment) |
Then, I would add this test to the def test_is_up_to_date_when_not_written(self):
dn_confg_1 = Config.configure_in_memory_data_node("dn_1", default_data="a")
dn_confg_2 = Config.configure_in_memory_data_node("dn_2")
task_config_1 = Config.configure_task("t1", funct_a_b, [dn_confg_1], [dn_confg_2])
scenario_config = Config.configure_scenario("sc", [task_config_1])
scenario = tp.create_scenario(scenario_config)
assert scenario.dn_1.is_up_to_date is True
assert scenario.dn_2.is_up_to_date is False
tp.submit(scenario)
assert scenario.dn_1.is_up_to_date is True
assert scenario.dn_2.is_up_to_date is True The idea is to have 2 data nodes:
|
Hey @trgiangdo , sorry for inconvenience, actually when this issue was created, the code which I've copied was given in the description, and that's why I copied that. I'll change the code and add the tests as well, as told by you. |
Thanks for your feedback. The code in the issue description is just a prototype and not actually tested. The one who is assigned to the issue needs to handle the actual implementation and test the fix. |
Sure, I'll take care of this while contributing to other issues in this project 👍 |
Also, I've added the code and the tests as well, it's working now 👍, only 1 test is getting failed (which was already present) - |
What do you mean the failed test Also, there is a linter error:
where you left some redundant whitespaces at the end of the line. |
Sorry for the inconvenienced caused, ig the error was due to my mistake I accidentally left those white spaces in my code, I'll take care of it from the next time👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added 2 commits, 1 fix the whitespaces, and 1 fix the return in the wrong scope. The tests are all passing now.
Thank you again for your contribution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
Thank you very much for your contribution.
…rror-when-never-written-before
Fixes #1198