Skip to content

Commit

Permalink
Add the path to the source code to sys.path in tests
Browse files Browse the repository at this point in the history
This is needed so that pytest can actually import dgmr to run the tests
  • Loading branch information
Mews committed Jun 11, 2024
1 parent b018594 commit 568992d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_losses.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
""" Test loss functions"""

import os
import sys

sys.path.insert(
0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
)

from dgmr.losses import SSIMLoss, MS_SSIMLoss, SSIMLossDynamic, tv_loss
import torch

Expand Down
7 changes: 7 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import os
import sys

sys.path.insert(
0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
)

import torch
import torch.nn.functional as F
from dgmr import (
Expand Down

0 comments on commit 568992d

Please sign in to comment.