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

Test installer #57

Merged
merged 10 commits into from
Aug 3, 2019
Merged

Test installer #57

merged 10 commits into from
Aug 3, 2019

Conversation

singh-lokendra
Copy link
Collaborator

  • Added tests for installer.py
  • updated wrapper calls with instantiation approach
  • build lttoolbox until package is updated

load dictionary during instatiation to reduce time
apertium_core clone  wrapper_optimise branch
lttoolbox: build wrapper until package isnt updated
elif 'apertium-postchunk' == command[0]:
obj = apertium_core.apertium()
obj.postchunk_text(arg, command[1], command[2], input_file.name, output_file.name)
obj = apertium_core.postchunk(command[1], command[2])
Copy link
Member

Choose a reason for hiding this comment

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

This is fine to start off but we really need to cache all these to get any benefit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I don't mean caching the result of postchunk/interchunk/etc. I mean keeping the objects around to avoid initialization costs.

apertium/utils.py Outdated Show resolved Hide resolved
tests/__init__.py Outdated Show resolved Hide resolved
tests/__init__.py Outdated Show resolved Hide resolved
tests/__init__.py Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Aug 1, 2019

Pull Request Test Coverage Report for Build 388

  • 34 of 34 (100.0%) changed or added relevant lines in 2 files are covered.
  • 4 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+1.3%) to 73.522%

Files with Coverage Reduction New Missed Lines %
/home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages/apertium_core.py 1 73.06%
/home/travis/virtualenv/python3.8-dev/lib/python3.8/site-packages/apertium_core.py 1 73.06%
/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/apertium_core.py 1 73.06%
/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/apertium_core.py 1 73.06%
Totals Coverage Status
Change from base Build 370: 1.3%
Covered Lines: 2288
Relevant Lines: 3112

💛 - Coveralls

@@ -69,6 +72,24 @@ def test_uninstalled_mode(self):
apertium.generate('spa', 'cat<n><pl>')


class TestInstallation(unittest.TestCase):
def test_apertium_base(self):
apertium.installer.install_apertium()
Copy link
Member

Choose a reason for hiding this comment

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

This test should probably ensure that lt-proc doesn't already exist. It should also test for all the binaries, not just lt-proc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test should probably ensure that lt-proc doesn't already exist.

Can you explain a bit more

It should also test for all the binaries, not just lt-proc?

Since the installer is installing apertium-all-dev, I am assuming all of the binaries to be available in the packages. I am checking existence of lt-proc as its the most used binary

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer all the ones we use to be tested. Tests should assume as little as possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Even though I've over ridden the constructor, installation process is repeated 8 times while running tests https://travis-ci.com/apertium/apertium-python/jobs/221738455#L1714. What's the reason behind this?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not really sure but you don't need to make each assert its own test. They can all be one test where you loop through the binaries you expect. Also, I would check that they don't exist before installation. Otherwise, you can't be certain your installation actually did anything.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The binaries would be available after running the installer. Should I create an uninstaller as well.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm... I don't think there's a good way to test this particular aspect then. Or at least I can't think of one atm. I don't think it's worth the effort to create an uninstaller.

Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment that notes that this test doesn't actually test as much as it might seem to?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the current name is misleading. Should I rename it to test_apertium_binaries

@sushain97 sushain97 merged commit f9f69d4 into master Aug 3, 2019
@singh-lokendra singh-lokendra deleted the test_installer branch August 10, 2019 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants