Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guillermooo/AAAPT
Test framework for Sublime Text 3 packages
https://github.com/guillermooo/AAAPT
Last synced: 3 months ago
JSON representation
Test framework for Sublime Text 3 packages
- Host: GitHub
- URL: https://github.com/guillermooo/AAAPT
- Owner: guillermooo
- License: other
- Created: 2013-08-19T21:31:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-25T19:06:58.000Z (about 11 years ago)
- Last Synced: 2024-07-15T15:38:39.988Z (4 months ago)
- Language: Python
- Size: 132 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.txt
- License: LICENSE.txt
Awesome Lists containing this project
README
AAAPT
=====Package Tests - a test framework for Sublime Text packages.
Installation
------------1. Download the [latest build](https://bitbucket.org/guillermooo/aaapt/downloads/AAAPT.sublime-package)
2. Copy *AAAPT.sublime-package* to *Packages/Installed Packages*
3. Restart Sublime Text.To locate *Packages/Installed Packages*, you can open the console (Ctrl+`) and run this:
```python
sublime.installed_packages_path()
```How to Use
----------AAAPT lets you run tests in the context of Sublime Text. To use AAAPT correctly you need to ensure
two things:* Your package has specified tests to be run by AAAPT
* There's no other currently loaded *.sublime-package* that includes AAPT testsSpecifying tests is easy. Simply create a file like *test_harness.py* at the top level of your
*FooPackage.sublime-package* and include something like this:```python
from AAAPT.runner import register_teststest_suites = {
'baz': ['FooPackage.tests.test_baz'],
}register_tests(test_suites)
```Now you can write the still inexistent tests. First we create a file to hold them:
```bash
cd path/to/FooPackage
touch tests/test_baz.py
```Then we write the tests:
```python
import unittestfrom AAAPT.utils import BufferTest
# Test that uses AAAPT's helpers.
class Test_BufferSample(BufferTest):
def testSample(self):
self.set_text('foo bar\nfizz buzz\n')
self.add_sel(self.R((1, 0), (1, 4)))
self.assertEqual(self.view.substr(self.first_sel()), 'fuzz')# Regular test.
class Test_Sample(unittest.TestCase):
def testSample(self):
self.assertTrue(False)
```Finally, we can publish *FooPackage.sublime-package* to *Installed Packages*, restart
Sublime Text and, from the Command Palette, select **Run Active Tests...**. The results of the
test run will be printed to a new view.Donate
------If you like this package and want to thank me, you can do so here:
Paypal
Gittip
Pledgie