Browse Source

Fix merge

jean-robin medori 4 days ago
parent
commit
3c7f09790b
2 changed files with 8 additions and 3 deletions
  1. 2 1
      taipy/core/_entity/_reload.py
  2. 6 2
      tests/core/_entity/test_reload.py

+ 2 - 1
taipy/core/_entity/_reload.py

@@ -24,11 +24,12 @@ class _Reloader:
 
     _instance = None
     _lock = threading.RLock()
+    _managers: Dict[str, Type[_Manager]] = {}
 
     def __new__(cls, *args, **kwargs):
         with cls._lock:
             if not isinstance(cls._instance, cls):
-                cls._instance = super().__new__(cls *args, **kwargs)
+                cls._instance = super().__new__(cls, *args, **kwargs)
                 cls._instance._no_reload_context = False  # Initialize once
                 cls._instance._context_depth = 0  # Track nested `with` usage
             cls._managers = cls._build_managers()

+ 6 - 2
tests/core/_entity/test_reload.py

@@ -8,6 +8,8 @@
 # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 # specific language governing permissions and limitations under the License.
+from datetime import datetime
+
 import pytest
 
 import taipy as tp
@@ -36,7 +38,8 @@ class TestReloader:
     def test_single_context(self):
         dn = tp.create_global_data_node(Config.configure_data_node("dn1", scope=tp.Scope.GLOBAL))
         assert len(dn.edits) == 0
-        dn.track_edit(comments="inside") # creates a new edit in memory without saving the data node
+        edit = {"comments": "inside", "timestamp": datetime.now()}
+        dn._edits.append(edit) # add a new edit in memory without saving the data node
         reloader = _Reloader()
         with reloader:
             assert reloader._context_depth == 1
@@ -49,7 +52,8 @@ class TestReloader:
     def test_nested_contexts(self):
         dn = tp.create_global_data_node(Config.configure_data_node("dn1", scope=tp.Scope.GLOBAL))
         assert len(dn.edits) == 0
-        dn.track_edit(comments="inside") # creates a new edit in memory without saving the data node
+        edit = {"comments": "inside", "timestamp": datetime.now()}
+        dn._edits.append(edit)  # add a new edit in memory without saving the data node
         reloader = _Reloader()
         with reloader:
             assert reloader._context_depth == 1