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

Describe testing approach #14

Open
SiggyF opened this issue Aug 13, 2014 · 2 comments
Open

Describe testing approach #14

SiggyF opened this issue Aug 13, 2014 · 2 comments

Comments

@SiggyF
Copy link

SiggyF commented Aug 13, 2014

I ran into an error that I would like to fix, after enabling forpy-mode and running M-?:

deferred error : (error "\"AttributeError(\\\"'UserContext' object has no attribute 'module'\\\",)\"")

I believe that there might be a missing self.module = None in the usercontext class init.

To test it I want to write a python unit test. I did find the tox.ini file, implying that I should test with the tox command. If I run it it can't find any unit tests. Are there no unit tests yet? Can you suggest where I should put such a test?

@rosenbrockc
Copy link
Owner

Thank-you for being willing to track the error down. I previously had all the testing folders in .gitignore while I was fleshing things out, I added them to the repo now. If you look in tests/isense/original, there are three Fortran files that I have been using for the unit testing of isense. I abbreviate them with the keys "monte", "deriv" and "cefit" in the isense.py module that actually performs the tests. In the isense module, there is a method called get_completion_tests that lists the kind of isense test to perform (essentially any of the callable attributes on the fortpy.isense.__init__.Script class) as well as the line number and char index of the cursor location in the relevant code file.

Let me know if you have questions. There is a debug module, but I wasn't consistent with inserting the debug assertions etc. throughout the code, so it is close to useless at this point. I have an issue open to go through the code and add some strategic debug references but I haven't got around to it yet. Also the full definition lookup (M-?) hasn't really been tested well. I have only a single test case in the unit tests for that one because most of the people using fortpy so far haven't been clamoring for it (you are the first). If you want to try and figure out the problem, I would appreciate it.

I pushed some changes a few minutes ago that you should probably pull before you start debugging. Thanks!

@rosenbrockc
Copy link
Owner

Also (you probably will see this from the code anyway, but...) the results of the isense completions etc. are written to files in the tests/isense directory and have names like compl_*.tmp where the * is the key of the code file that was being tested. If you compare the cursor position in the code file with the output saved in the compl_*.tmp files, it should become obvious how to use the unit tester.

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

No branches or pull requests

2 participants