Skip to content

Commit d89ac45

Browse files
committed
Updated rockspec test file to remove redundant test and update file names as original file names were changed
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
1 parent 9637987 commit d89ac45

1 file changed

Lines changed: 21 additions & 33 deletions

File tree

tests/packagedcode/test_rockspec.py

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,39 +27,39 @@ class TestRockspecHandler(PackageTester):
2727

2828
test_data_dir = os.path.join(os.path.dirname(__file__), 'data')
2929

30-
def test_parse_test_rockspec(self):
31-
"""Test parsing test.rockspec."""
32-
test_file = self.get_test_loc('rockspec/test.rockspec')
30+
def test_parse_lua_cjson_rockspec(self):
31+
"""Test parsing lua-cjson.rockspec."""
32+
test_file = self.get_test_loc('rockspec/lua-cjson.rockspec')
3333
packages = rockspec.RockspecHandler.parse(test_file)
34-
expected_loc = self.get_test_loc('rockspec/test.rockspec-expected.json')
34+
expected_loc = self.get_test_loc('rockspec/lua-cjson.rockspec-expected.json')
3535
self.check_packages_data(packages, expected_loc, regen=REGEN_TEST_FIXTURES)
3636

37-
def test_parse_test1_rockspec(self):
38-
"""Test parsing test1.rockspec with mandatory and optional fields."""
39-
test_file = self.get_test_loc('rockspec/test1.rockspec')
37+
def test_parse_kong_rockspec(self):
38+
"""Test parsing kong.rockspec with mandatory and optional fields."""
39+
test_file = self.get_test_loc('rockspec/kong.rockspec')
4040
packages = rockspec.RockspecHandler.parse(test_file)
41-
expected_loc = self.get_test_loc('rockspec/test1.rockspec-expected.json')
41+
expected_loc = self.get_test_loc('rockspec/kong.rockspec-expected.json')
4242
self.check_packages_data(packages, expected_loc, regen=REGEN_TEST_FIXTURES)
4343

44-
def test_parse_test2_rockspec(self):
45-
"""Test parsing test2.rockspec."""
46-
test_file = self.get_test_loc('rockspec/test2.rockspec')
44+
def test_parse_luasocket_rockspec(self):
45+
"""Test parsing luasocket.rockspec."""
46+
test_file = self.get_test_loc('rockspec/luasocket.rockspec')
4747
packages = rockspec.RockspecHandler.parse(test_file)
48-
expected_loc = self.get_test_loc('rockspec/test2.rockspec-expected.json')
48+
expected_loc = self.get_test_loc('rockspec/luasocket.rockspec-expected.json')
4949
self.check_packages_data(packages, expected_loc, regen=REGEN_TEST_FIXTURES)
5050

51-
def test_parse_test3_rockspec(self):
52-
"""Test parsing test3.rockspec."""
53-
test_file = self.get_test_loc('rockspec/test3.rockspec')
51+
def test_parse_vdsl_rockspec(self):
52+
"""Test parsing vdsl.rockspec."""
53+
test_file = self.get_test_loc('rockspec/vdsl.rockspec')
5454
packages = rockspec.RockspecHandler.parse(test_file)
55-
expected_loc = self.get_test_loc('rockspec/test3.rockspec-expected.json')
55+
expected_loc = self.get_test_loc('rockspec/vdsl.rockspec-expected.json')
5656
self.check_packages_data(packages, expected_loc, regen=REGEN_TEST_FIXTURES)
5757

58-
def test_parse_test4_rockspec(self):
59-
"""Test parsing test4.rockspec with variable concatenation."""
60-
test_file = self.get_test_loc('rockspec/test4.rockspec')
58+
def test_parse_claude_nvim_rockspec(self):
59+
"""Test parsing claude.nvim.rockspec with variable concatenation."""
60+
test_file = self.get_test_loc('rockspec/claude.nvim.rockspec')
6161
packages = rockspec.RockspecHandler.parse(test_file)
62-
expected_loc = self.get_test_loc('rockspec/test4.rockspec-expected.json')
62+
expected_loc = self.get_test_loc('rockspec/claude.nvim.rockspec-expected.json')
6363
self.check_packages_data(packages, expected_loc, regen=REGEN_TEST_FIXTURES)
6464

6565
def test_handler_is_registered(self):
@@ -70,13 +70,6 @@ def test_handler_is_registered(self):
7070
assert len(handlers) == 1, f"Expected 1 RockspecHandler, found {len(handlers)}"
7171
assert handlers[0] == rockspec.RockspecHandler
7272

73-
def test_handler_in_datasource_registry(self):
74-
"""Test that handler is registered in HANDLER_BY_DATASOURCE_ID registry."""
75-
from packagedcode import HANDLER_BY_DATASOURCE_ID
76-
handler = HANDLER_BY_DATASOURCE_ID.get('luarocks_rockspec')
77-
assert handler is not None, "RockspecHandler not found in registry"
78-
assert handler == rockspec.RockspecHandler
79-
8073
def test_handler_attributes(self):
8174
"""Test that handler has required attributes."""
8275
assert rockspec.RockspecHandler.datasource_id == 'luarocks_rockspec'
@@ -87,7 +80,7 @@ def test_handler_attributes(self):
8780

8881
def test_is_datafile_rockspec(self):
8982
"""Test that is_datafile recognizes .rockspec files."""
90-
test_file = self.get_test_loc('rockspec/test1.rockspec')
83+
test_file = self.get_test_loc('rockspec/kong.rockspec')
9184
assert rockspec.RockspecHandler.is_datafile(test_file)
9285

9386
def test_is_datafile_non_rockspec(self):
@@ -98,8 +91,3 @@ def test_is_datafile_non_rockspec(self):
9891
assert not rockspec.RockspecHandler.is_datafile(temp_file)
9992
finally:
10093
os.unlink(temp_file)
101-
102-
103-
if __name__ == '__main__':
104-
import pytest
105-
pytest.main([__file__, '-v'])

0 commit comments

Comments
 (0)