Skip to content

Commit

Permalink
fixed relative package issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Byrne committed Jan 29, 2024
1 parent a0bafe3 commit 6d8c1eb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 9 additions & 3 deletions agrinet/tests/testDataLoader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import unittest
import sys
import os

# fixes "ModuleNotFoundError: No module named 'utils'"
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))

# flake8: noqa
import unittest
import tensorflow as tf
from utils.DataLoader import load_image_test, load_image_train, resize

Expand All @@ -15,7 +21,7 @@ def tearDown(self):

def test_load_image_train(self):
# Condition: input_image.shape != real_image.shape from the train dataset
image_file = "../assets/green-field.jpg"
image_file = "assets/green-field.jpg"
input_image, real_image = load_image_train(image_file)

self.assertIsInstance(input_image, tf.Tensor)
Expand All @@ -25,7 +31,7 @@ def test_load_image_train(self):

def test_load_image_test(self):
# Condition: input_image.shape == real_image.shape from the test dataset
image_file = "../assets/green-field.jpg"
image_file = "assets/green-field.jpg"

input_image, real_image = load_image_test(image_file)

Expand Down
8 changes: 7 additions & 1 deletion agrinet/tests/testLogManager.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import sys
import os

# fixes "ModuleNotFoundError: No module named 'utils'"
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))

# flake8: noqa
import unittest
from io import StringIO
from unittest.mock import patch

from utils.LogManager import LogManager


Expand Down

0 comments on commit 6d8c1eb

Please sign in to comment.