Coder Social home page Coder Social logo

aaapt's Introduction

AAAPT

Package Tests - a test framework for Sublime Text packages.

Installation

  1. Download the latest build
  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:

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 tests

Specifying 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:

from AAAPT.runner import register_tests

test_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:

cd path/to/FooPackage
touch tests/test_baz.py

Then we write the tests:

import unittest

from 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

aaapt's People

Contributors

guillermooo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aaapt's Issues

Packages/Installed Packages

The README mentions copying AAAPT.sublime-package to Packages/Installed Packages. I don't see Installed Packages in my Packages folder. Am I missing something, or are you talking about the Installed Packages folder that's a sibling of Packages?

image

AAAPT.sublime-package missing files

The AAAPT.sublime-package file that you link to in your README is missing some files:
screen shot

I think that you need Default.sublime-commands for the AAAPT: Run Active Tests... command to be registered.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.