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

Fix using the default session while removing a task #131

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rocketry/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def add_task(self, task: 'Task'):
def remove_task(self, task: Union['Task', str]):
if isinstance(task, str):
task = self[task]
self.session.tasks.remove(task)
self.tasks.remove(task)

def task_exists(self, task: 'Task'):
warnings.warn((
Expand Down
2 changes: 1 addition & 1 deletion rocketry/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def session():
"task_execution": "process",
}, delete_existing_loggers=True)
rocketry.session = session
session.set_as_default()
# session.set_as_default()
Copy link
Owner

Choose a reason for hiding this comment

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

I think the tests fail because of this. I'll investigate this further but I think what you did here should be done as the default sessions should be eventually removed.

Copy link
Owner

Choose a reason for hiding this comment

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

Inspecting the tests that failed, I think the fault is just in the tests. This failure rocketry/test/condition/test_core.py:62: AssertionError relies on the boolean operation of the conditions which is not actually used by the internals but this uses the defaults as you cannot pass arguments to __bool__ except the object itself.


task_logger = logging.getLogger(session.config.task_logger_basename)
task_logger.handlers = [
Expand Down