Skip to content

Commit

Permalink
added copyright notes, simplified fixtures, fixed path to fixtures json
Browse files Browse the repository at this point in the history
  • Loading branch information
tdoehmen committed Aug 9, 2022
1 parent 4a91ff9 commit c513bbe
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
18 changes: 17 additions & 1 deletion python/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#
# Copyright 2022 Hopsworks AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
#

import pytest
from tests.fixtures.backend_fixtures import response_get_feature_group
from tests.fixtures.backend_fixtures import backend_fixtures

pytest_plugins = [
"tests.fixtures.backend_fixtures",
Expand Down
24 changes: 20 additions & 4 deletions python/tests/fixtures/backend_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
#
# Copyright 2022 Hopsworks AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.
#

import pytest
import json

with open('tests/fixtures/backend_fixtures.json', 'r') as json_file:
backend_fixtures = json.load(json_file)
with open('python/tests/fixtures/backend_fixtures.json', 'r') as json_file:
backend_fixtures_json = json.load(json_file)

@pytest.fixture
def response_get_feature_group():
return backend_fixtures["get_feature_group"]["response"]
def backend_fixtures():
return backend_fixtures_json
4 changes: 2 additions & 2 deletions python/tests/test_feature_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

class TestFeatureGroup:

def test_from_response_json(self, response_get_feature_group):
fg = FeatureGroup.from_response_json(response_get_feature_group)[0]
def test_from_response_json(self, backend_fixtures):
fg = FeatureGroup.from_response_json(backend_fixtures["get_feature_group"]["response"])[0]

assert fg.id == 15
assert len(fg._features) == 2
Expand Down

0 comments on commit c513bbe

Please sign in to comment.