Skip to content

Commit

Permalink
Fix import (#14)
Browse files Browse the repository at this point in the history
* Bump to 0.28.1
* Fix namespace package in dist
* Upgrade jinja2 (security patch)
* Remove .gitlab-ci.yml
* Fix test failures due to static test methods
  • Loading branch information
markroth8 authored Mar 27, 2024
1 parent 7c7e960 commit 508d9f3
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 134 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ memento/twosigma/memento/generated/
.settings
.classpath
.project
venv/
54 changes: 0 additions & 54 deletions .gitlab-ci.yml

This file was deleted.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies = [
"graphviz>=0.13",
"pandas>=1.0.5",
"numpy>=1.15.4",
"jinja2>=2.10",
"jinja2>=3.1.3",
"python-dateutil>=2.8",
"pyyaml>=3.13",
"tqdm>=4.31.1"
Expand All @@ -40,7 +40,7 @@ Issues = "https://github.com/twosigma/memento/issues"
Source = "https://github.com/twosigma/memento"

[tool.hatch.build.targets.wheel]
packages = ["twosigma/memento"]
packages = ["twosigma"]

[tool.hatch.version]
path = "twosigma/memento/__about__.py"
Expand Down Expand Up @@ -75,4 +75,4 @@ exclude_lines = [
markers = [
"slow: marks tests as slow",
"needs_canonical_version: marks tests as needing to run with a specific version of python, for hash stability"
]
]
3 changes: 1 addition & 2 deletions tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ def test_environment_set_file_yaml(self):
if d:
shutil.rmtree(d)

@staticmethod
def get_sample_config():
def get_sample_config(self):
return {
"name": "config1",
"description": "description1",
Expand Down
24 changes: 8 additions & 16 deletions tests/test_runner_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ def setup_method(self):
def teardown_method(self):
pass

@staticmethod
def test_memoize():
def test_memoize(self):
# This also tests serializing function references
assert {
"a": 1,
Expand All @@ -68,8 +67,7 @@ def test_memoize():
1, c=[{"three": 3}], b=2, e=runner_fn_test_1, f=[{"a": runner_fn_test_1}]
)

@staticmethod
def test_call_stack_invocations_tracked():
def test_call_stack_invocations_tracked(self):
# runner_fn_test_apply_and_double -->
# runner_fn_test_apply_and_double -->
# runner_fn_test_add
Expand Down Expand Up @@ -102,8 +100,7 @@ def test_call_stack_invocations_tracked():
== invocations[1].fn_reference.function_name
)

@staticmethod
def test_correlation_id():
def test_correlation_id(self):
"""
Test that a correlation id is generated and properly propagated
Expand All @@ -119,8 +116,7 @@ def test_correlation_id():
corr_id_2 = memento_2.correlation_id
assert corr_id_1 == corr_id_2

@staticmethod
def test_prevent_further_calls():
def test_prevent_further_calls(self):
"""
Test that prevent_further_calls in recursive context prevents additional
Memento calls.
Expand All @@ -135,8 +131,7 @@ def test_prevent_further_calls():
# the error, that means the RuntimeError happened on the wrong call (too early).
assert "Caught further calls error" in str(e)

@staticmethod
def test_refuse_execution_of_non_dependencies():
def test_refuse_execution_of_non_dependencies(self):
"""
Test that Memento refuses to execute a down-stream function that is not declared
or detected as a dependency in the parent chain.
Expand All @@ -148,8 +143,7 @@ def test_refuse_execution_of_non_dependencies():
# But allowed if explicit version is set:
assert 1 == fn_with_explicit_version_calls_undeclared_dependency()

@staticmethod
def test_key_override_result():
def test_key_override_result(self):
"""
Test that, if a function returns `KeyOverrideResult`, the result is stored at
the overridden key instead of the standard location.
Expand All @@ -159,8 +153,7 @@ def test_key_override_result():
mem = fn_returns_key_override_result.memento()
assert "custom_key" == mem.content_key.key

@staticmethod
def test_memento_dependencies():
def test_memento_dependencies(self):
"""
Test that, given a -> b -> c, we can extract the full call stack from the memento.
In this test, we make a -> b a batch call so that we override any speculative local
Expand All @@ -184,8 +177,7 @@ def test_memento_dependencies():
== i_b.invocations[0].fn_reference.qualified_name
)

@staticmethod
def test_memento_graph():
def test_memento_graph(self):
"""
Test that, given a -> b -> c, we can extract the full call stack from the memento.
In this test, we make a -> b a batch call so that we override any speculative local
Expand Down
3 changes: 1 addition & 2 deletions tests/test_runner_null.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def teardown_method(self):
shutil.rmtree(self.base_path)
m.Environment.set(self.original_env)

@staticmethod
def test_null_runner():
def test_null_runner(self):
with pytest.raises(RuntimeError):
fn1()
Loading

0 comments on commit 508d9f3

Please sign in to comment.