-
Notifications
You must be signed in to change notification settings - Fork 27
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
Test installer #57
Conversation
load dictionary during instatiation to reduce time
apertium_core clone wrapper_optimise branch lttoolbox: build wrapper until package isnt updated
apertium/utils.py
Outdated
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]) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about functools.lru_cache
, available in python https://docs.python.org/3/library/functools.html?highlight=lru_cache#functools.lru_cache
There was a problem hiding this comment.
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.
Pull Request Test Coverage Report for Build 388
💛 - 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() |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
installer.py
lttoolbox
until package is updated