Skip to content

Releases: byexamples/byexample

6.0.0

16 Jul 13:18
Compare
Choose a tag to compare

Changes from previous version:
Fixes

  • Made deterministic the output of the captured texts shown when the
    example fails.
  • Parse the examples after removing duplicated/overlapping ones. This
    prevents that a malformed example that would be removed later gets
    parsed before making the whole process to fail.
  • Remove the word TIMEOUT from the help, this was the name of the
    option a long time ago.
  • Fix the traceback printed when the example crashes.
  • Fix ExampleHarvest's name.

Enhancements

  • Added a rm option to define a set of chars that should be removed
    from the expected and the got strings. See 6050a88 for a small example.
  • Detect when a Ruby example expects the representation of
    the value of the executed expression (=>). If detected, capture the
    representation and check it as usual; if not, ignore it. This free the
    user from adding ; at the end of each line or using "+pass" hacks. This
    change in theory should be backward compatible and can be changed via
    +ruby-expr-print by setting it to true (always check), false
    never check or auto (auto detect, the default).
  • Two hooks (end_example, finally_example); allow got modification from
    concern.
  • Created a 'meta' attribute in the example, a mutable dictionary.
    Under the key 'got' it should be the got string that can be changed from
    the end_example and finally_example hooks.
  • Enable the redefinition of the command line to spawn a given
    runner/interpreter using the option shebang. This was enabled by all
    the runner/interpreted supported by byexample. See 6e3abae or
    docs/usage.md.
  • The timeout option now accepts a fraction of seconds.
  • Tagged each module with a stability tag: fine tuned the versioning.
    See 5f3d049 and README.md.

Incompatible changes (examples)

  • Enable by default pp (pretty print) for ruby exprs' outputs. This can
    be disabled from the command line with the option ruby-pretty-print
  • Use .. as the second prompt for the Ruby examples. This make
    the life easier when the examples are multilines. See 9784f38 for more
    details.

Incompatible changes (lib)

  • The shebang option required a non backward compatibility change
    of the internal class PexepctMixin.
  • The shebang option also is "not" compatible with Python 2.6.
  • We are dropping the support for Python 2.6 (for the execution of
    byexample itself, not the runner/interpreter of examples in
    Python)

5.0.0

24 Jun 00:15
Compare
Choose a tag to compare

Changes from previous version:

Fixes

  • Prevented long running checks (#28) using a linear matching
    algorithm.
  • When an example fails, byexample will try to fill the tags in the
    expected with the got's pieces. Put a limit (timeout) when computing
    this to prevent long running. See #29. Set this to 2 secs.
  • Fixed a pathological regex of the form \s+ \s+. Because the tag
    can match nothing (the empty string), the resulting regex was \s+\s+
    which leaded to a lot of backtracking.
  • Fixed Differ's print of the captured strings (removed trailing
    whitespace)
  • Fixed an integer division on Python 3, in the Differ code.

Enhancements

  • New doc about how byexample show the differences in a failing example:
    docs/differences.rst
  • Implemented a linear matching algorithm (#28) to see if a expected string
    matches or not the got one in an example. This should not be faster
    but also it should be safer (see #23) without doing more hacks (see #25)
  • Improve exception handling: print the exception class and print a
    hint for the user: run the example in verbose mode to get the full
    traceback.
  • When an example fails, byexample will try to fill the tags in the
    expected with the got's pieces. The algorithm now performs a more
    aggressive strategy to make more clear expected strings and therefore
    more clear diffs.

Incompatible changes (examples)

  • Repeating a named capture tag () in the same example is not
    allowed anymore. Previously this meant that the captured string under
    the same tag must be the same string. But this prevented further
    improvements and it was a feature implemented without a real reason of
    the benefits.
  • Replaced 'capture' option by 'tags'

Incompatible changes (command line)

  • Replaced 'capture' option by 'tags'

Incompatible changes (lib)

  • Refactor the Checker and replaced by Differ (who do the diffs) and
    the Expected's subclasses (who do the comparison): LinearExpected and
    RegexExpected.
  • The namedtuple Expected was replaced by a full class Expected.
  • The interface of Expected and Differ changed.
  • Renamed module checker.py by differ.py and created a new one:
    expected.py

Incompatible changes (modules)

  • Because the Checker interface changed (now is Differ) and the
    Expected changed too, this may affect the third party modules (3rd party
    interpreters and concerns)

4.2.1 - Huff: human diff

30 Apr 02:52
Compare
Choose a tag to compare

Changes from previous version:

Fixes:

  • Fixed an incorrect comparison in the diff algorithm.

Enhancements:

  • Implemented huff: a more human readable diff program.

4.2.0 - Improve errors' messages

28 Feb 03:31
Compare
Choose a tag to compare

4.2.0 - Improve errors' messages
Changes from previous version:

Enhancements

  • Do not print the traceback by default to avoid printing internal
    stuff for common mistakes. But print it if verbose is greather than
    0.
  • Suppress any error's message in quiet mode.
  • Improved all the errors' messages trying to use more descriptive
    messages. Extend them adding in which file and number line (if
    possible) the error is located and who was the responsible of it.

Incompatible changes (lib)

  • Remove the 'where' attribute/parameter from almost everywhere
    This affects some very public methods:

    • ExampleParser: process_snippet_and_expected, extract_options

    And others not so public:

    • ExampleFinder: check_keep_matching
    • ExampleParser: expected_as_regexs

4.1.0 - Performance Improvements

28 Feb 03:31
Compare
Choose a tag to compare

4.1.0 - Performance Improvements
Changes from previous version:
Fixes

  • Reimplemented (and fixed) the universal newlines: now the sequence
    \r\n and \r are replaced by \n correctly.
  • Removed a hardcoded delay when sending something to the underlying
    interpreter. Before was a delay of 0.01 secs, now it is disabled.
    See eb37d35.

Enhancements

  • Cached the compilation of the regexs avoiding calling re.compile
    more than once for a regex.
    The improvement is small as re.compile already has a cache for this
    but it is better to cache ourselves in case we want to change the
    regex engine (Python's re module for now)
  • Refactor of internal ExampleParser's methods allowing to change the
    meaning of things like 'whitespace' or 'ellipsis'.
  • Do not delay the sending of input to the interpreter; make it as
    faster as possible. Before was a delay of 0.01 secs, now it is
    disabled. See eb37d35.
    If needed, the flag 'delaybeforesend' can control this delay (none by
    default) from the command line (-o option) or from the example's
    options string.

4.0.1

17 Feb 23:44
Compare
Choose a tag to compare

4.0.1
Changes:

  • Instead of patching an internal function of pprint for the custom
    display hook of the Python interpreter, patch the repr function.
    This should be a backward compatibility fix.
  • Improve the docs.

4.0.0

15 Feb 02:21
Compare
Choose a tag to compare

4.0.0
Changes from previous version:

Fixes

  • The empty lines at the end of the expected and got strings are
    really ignored, not only the last one. This was the original
    intention as most of the time an empty line at the end is an artifact
    of the parser/finder (for the expected string) and is an artifact of
    the interpreter (for the got string).
    If you really need to match an empty line at the end, use a capture
    tag.
  • The WS flag (whitespace) was triggering the replacement of all the
    whitespaces by a single space and the replacement by a \s+ regex.
    This double work ended up in a buggy behavior under some condition.
    Now the \s+ implementation is used and nothing else to support WS.
  • Fixed the the u/b Python's markers: by mistake, the strings b' were
    replaced by ' in every case. Now, we replace this only if b' is a
    real string marker. The same for u'

Enhancements

  • Before calculating the diff, the captured tags in the expected string
    are replaced by the captured string from the got string.
    This improves the posterior diff.
    However, it is not possible to replace all the capture tags: only the
    tags before the first difference and the tags after the last difference
    can be 'safely' replaced.
    This enhancement can be disabled with --no-enhance-diff
  • Thanks to the expected_as_regexs modification, the regexs are line
    oriented which should improve the diff.
    This enhancement can be disabled with --no-enhance-diff
  • Improved the error message when an examples is misaligned showing a
    few lines above and below to give more context.
  • Print the named captured tags and their captured strings after
    showing the diff in a failed example. This should give the user a
    hint of what and how much is begin captured and by what tag.
    This enhancement can be disabled with --no-enhance-diff
  • Made the check of overlapping examples more relaxed:
    • If one example is fully contained by the other, then it's dropped.
    • If one example span the same lines that the other and both are of
      the same language, then it's dropped.
    • In other case of overlapping, raise an exception.
  • Use ^n instead of to mark where the empty lines are. This
    is more consistent with the rest of the diff hints.
    This enhancement can be disabled with --no-enhance-diff
  • Implemented the '+py-doctest' option for Python to be (almost) full
    compatible with Python's doctest.
  • Implemented the '+py-pretty-print' option for Python to tweak the
    string representations (u/b markers) and the use of pprint as display
    hook. Enabled by default (like always), it is disabled when the user
    sets '+py-doctest' (compatibility with doctest) but it can be
    reenabled with '+py-pretty-print'.
  • New flag: --show-options. List the available options that byexample
    and the given selected languages support and can be set on an
    example.
  • Improved how the examples are printed in debug/verbose mode.
  • Allow empty lines in an example to be non-indented. See e937a0c
  • Show the version, license, author and github url in the output of
    --version/-V

Incompatible changes (lib)

  • expected_as_regexs now returns a list of regular expressions
    instead of a single regex. In addition, the position from where
    each regex was created in the expected string is recorded.
  • The Example class changed accordingly.
  • Refactor all the stuff related to the expected string of an Example
    into a separated structure Expected (an attribute of Example).
  • Moved the Checker class to its own module checker.py
  • Splinted byexample.py into cmdline.py (parse the command line
    arguments) and init.py (to initialize all the main objects)
  • Refactorized the Finder class
  • Moved several functionalities from Parser to Finder. See 2c84dee.
  • Several renames. See 62669be and a2ba4b8:
    • First, rename the director classes and objects:
      • ExampleFinder -> ExampleHarvest
      • ExampleRunner -> FileExecutor
      • ExampleFinder instance (finder) -> harvester instance.
      • ExampleRunner instance (runner) -> executor instance.
      • executor's run method -> execute method.
    • Second, rename finders and interpreters (disruptive changes)
      • MatchFinder -> ExampleFinder
      • Interpreter -> ExampleRunner
      • Interpreter instances (interpreters) -> runners
      • initialize_interpreters method -> initialize_runners method.
      • shutdown_interpreters method -> shutdown_runners method.
      • example's interpreter attribute -> runner attribute.
    • Renamed the following files:
      • byexample.runner -> byexample.executor
      • byexample.interpreter -> byexample.runner

Incompatible changed (modules)

  • the classes that extend Parser needs to use a OptionParser (based on
    Python's argparse) to parse the options of an example.
    This is a disruptive change but it simplify the code (see b81f210)
    but it allows us to change some byexample's options from the example
    directly reusing the same parser and the same way to set the options.
    For example, an given example can say '+diff context' to set a
    particular diff algorithm for that example.
  • The keywords UDIFF, NDIFF and CDIFF are gone. Instead we use '+diff' with an
    argument with the same possible values like in the command line.
  • Reimplemented how we parse the '-o' strings (extra options from the
    command line). Now we use the same parser that we use for an
    example's options. See 59ed7a2.
  • All the options of byexample are now lowercase. This was the original
    intent: all the options of byexample should be like "+capture" instead of
    "+CAPTURE". (the uppercase version was to be compatible with Python's
    doctests)
  • Renamed 'WS' to 'norm-ws'.
  • Refactorized the interfaces adding better hooks to extend by
    subclasses and renaming with better names and concerns. See
    doc/how_to_extend.rst for a more complete overview of these new
    interfaces.
  • Replaced the +bash/+sh flags by +shell=xxx in the Shell module.
  • For Python, remove empty lines that may trick the interpreter into
    believe that a indented-block was closed when it is not. See f5a86f5.
    This fix can be disabled with -py-remove-empty-lines

Documentation:

  • improved the docs in general.

3.0.0: Support GDB, C++; new Concern (hooks) and much more.

15 Feb 02:22
Compare
Choose a tag to compare

Support GDB, C++; new Concern (hooks) and much more.
Changes from previous version:

Fixes

  • Fixed a bug in shell.py: remove the space after the prompt.

Enhancements

  • New language: GDB (GNU Debugger)
  • New language: C++
  • Find the examples written inside a fenced-code-block (Markdown style)
  • Reimplemented the blacklist/whitelist of languages: -l flag and support
    two syntaxes -l A -l B and -l A,B.
  • Experimental interactive mode: take the control of an interpreter for
    debugging.
  • Concern interface: extend byexample adding hooks to different stages.
    See doc/how_to_extend.rst and byexample/modules/progress.py.
  • Use env to spawn the interpreters
  • Changed --no-enhance-diff and --ff (fail fast) command line flags.
  • Added a per example timeout (TIMEOUT option and --timeout flag)
  • Highlight the examples when they are printted (requires pygments)
  • Better progress bar (requires tqdm).
  • Three possible status: PASS, FAIL and ABORT.
  • In the summary, take into account the Skipped when calculating the total
    count.
  • In the summary, do not print the aborted count; instead print the
    skipped examples count.
  • Changed the exec_and_wait: send one source line and expect one prompt
    at time. See commit #8e86d7f48 for the details, pros and contras.
  • Added a --version flag

Incompatible changes (command line)

  • Replaced --no-color by --pretty.
  • Removed -f (you can still use --ff and --fail-fast)
  • Renamed --search by --modules (you can also use -m)

Incompatible changes (interpreters)

  • Removed support for prompt # in Shell examples: the # symbol is too
    common and it is easy for byexample to get confuse

Incompatible changes (lib)

  • Refactor -> we have three components:
    • Finder: who will find the examples in a given string
    • Parser: who will parse the findings and transform them into Examples
    • Interpreter: who will execute the given Examples.
      See docs/how_to_extend.rst

Release 2.1.1

15 Feb 02:22
Compare
Choose a tag to compare

Release 2.1.1
Changes from previous version:

Fixes

  • Python 2.6 incompatibilities
  • Python 3.x incompatibilities
  • Fixed a +/-1 line number

Enhancements

  • Example timeout doesn't produce an exception anymore. Instead, log
    the error and fail the execution (like fail-fast)
  • Improved the documentation.
  • Command line flag to disable the colors in the output.
  • Added the possibility to set a value to an option, not only
    True/False like +FOO=VAL
  • Added a TIMEOUT option to change the timeout of a given example.

Incompatible changes

  • Ruby example will use >> as the primary and secondary prompt. The rb>
    and ... were removed. This is closer to the irb interpreter behaviour as
    well as how others show or write Ruby examples (in tutorials).