sus-fixtures-async-0.2.0/0000755000004100000410000000000015152127710015336 5ustar www-datawww-datasus-fixtures-async-0.2.0/sus-fixtures-async.gemspec0000644000004100000410000000630615152127710022504 0ustar www-datawww-data######################################################### # This file has been automatically generated by gem2tgz # ######################################################### # -*- encoding: utf-8 -*- # stub: sus-fixtures-async 0.2.0 ruby lib Gem::Specification.new do |s| s.name = "sus-fixtures-async".freeze s.version = "0.2.0".freeze s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.metadata = { "documentation_uri" => "https://socketry.github.io/sus-fixtures-async/", "funding_uri" => "https://github.com/sponsors/ioquatix/", "source_code_uri" => "https://github.com/socketry/sus-fixtures-async.git" } if s.respond_to? :metadata= s.require_paths = ["lib".freeze] s.authors = ["Samuel Williams".freeze] s.cert_chain = ["-----BEGIN CERTIFICATE-----\nMIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11\nZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK\nCZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz\nMjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd\nMBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj\nbzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB\nigKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2\n9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW\nsGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE\ne5AUKRwUuvaUaumA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0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=\n-----END CERTIFICATE-----\n".freeze] s.date = "2024-08-18" s.files = ["lib/sus/fixtures/async.rb".freeze, "lib/sus/fixtures/async/reactor_context.rb".freeze, "lib/sus/fixtures/async/scheduler_context.rb".freeze, "lib/sus/fixtures/async/version.rb".freeze, "license.md".freeze, "readme.md".freeze] s.homepage = "https://github.com/socketry/sus-fixtures-async".freeze s.licenses = ["MIT".freeze] s.required_ruby_version = Gem::Requirement.new(">= 3.1".freeze) s.rubygems_version = "3.5.11".freeze s.summary = "Test fixtures for running in Async.".freeze s.specification_version = 4 s.add_runtime_dependency(%q.freeze, [">= 0".freeze]) s.add_runtime_dependency(%q.freeze, ["~> 0.10".freeze]) end sus-fixtures-async-0.2.0/lib/0000755000004100000410000000000015152127710016104 5ustar www-datawww-datasus-fixtures-async-0.2.0/lib/sus/0000755000004100000410000000000015152127710016716 5ustar www-datawww-datasus-fixtures-async-0.2.0/lib/sus/fixtures/0000755000004100000410000000000015152127710020567 5ustar www-datawww-datasus-fixtures-async-0.2.0/lib/sus/fixtures/async/0000755000004100000410000000000015152127710021704 5ustar www-datawww-datasus-fixtures-async-0.2.0/lib/sus/fixtures/async/reactor_context.rb0000644000004100000410000000032715152127710025436 0ustar www-datawww-data# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2024, by Samuel Williams. require_relative 'scheduler_context' module Sus::Fixtures::Async ReactorContext = SchedulerContext end sus-fixtures-async-0.2.0/lib/sus/fixtures/async/version.rb0000644000004100000410000000027515152127710023722 0ustar www-datawww-data# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2024, by Samuel Williams. module Sus module Fixtures module Async VERSION = "0.2.0" end end end sus-fixtures-async-0.2.0/lib/sus/fixtures/async/scheduler_context.rb0000644000004100000410000000311015152127710025746 0ustar www-datawww-data# frozen_string_literal: true # Released under the MIT License. # Copyright, 2024, by Samuel Williams. require 'async' require 'sus/fixtures' module Sus::Fixtures::Async module SchedulerContext def run_with_timeout(timeout = nil, &block) task = ::Async::Task.current result = nil timer_task = nil if timeout timer_task = task.async(transient: true) do |task| # Wait for the timeout, at any point this task might be cancelled if the user code completes: task.annotate("Timer task timeout=#{timeout}.") task.sleep(timeout) # The timeout expired, so generate an error: buffer = StringIO.new scheduler.print_hierarchy(buffer) # Raise an error so it is logged: raise Async::TimeoutError, "Run time exceeded timeout #{timeout}s:\n#{buffer.string}" end end spec_task = task.async do |spec_task| spec_task.annotate("running example") begin result = yield(spec_task) ensure # We are finished, so stop the timer task if it was started: timer_task&.stop end # Now stop the scheduler: raise Async::Stop end begin timer_task&.wait spec_task.wait ensure spec_task.stop end return result end def timeout 60 end def scheduler Fiber.scheduler end alias reactor scheduler def around(&block) Sync do |task| task.annotate(self.class) run_with_timeout(self.timeout) do # This ensures all before/after blocks are also run in the scheduler context. super(&block) end end end end end sus-fixtures-async-0.2.0/lib/sus/fixtures/async.rb0000644000004100000410000000027015152127710022230 0ustar www-datawww-data# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2024, by Samuel Williams. require_relative 'async/version' require_relative 'async/reactor_context' sus-fixtures-async-0.2.0/checksums.yaml.gz.sig0000444000004100000410000000060015152127710021401 0ustar www-datawww-data_9q-IxB kڜ)qu$HtEq/m0>?%c>ޗ"8s#Ew磳 ydf-H)98<:y]x^DQ~'bꨓ~wD7".ՙG+mR “R=]0AlԧBHa3O#>|&vr"M<[V-"rh|mw xP:!RRdhڡ=ZPbK:k],m͜9fvUJI% Alp>?l@u62A鄨{O~ѓ6HzU~ 27Mm-īsus-fixtures-async-0.2.0/readme.md0000644000004100000410000000277215152127710017125 0ustar www-datawww-data# Sus::Fixtures::Async Provides a convenient fixture for testing async components in a reactor. [![Development Status](https://github.com/suspecting/sus-fixtures-async/workflows/Test/badge.svg)](https://github.com/suspecting/sus-fixtures-async/actions?workflow=Test) ## Usage Please see the [project documentation](https://socketry.github.io/sus-fixtures-async/) for more details. - [Getting Started](https://socketry.github.io/sus-fixtures-async/guides/getting-started/index) - This guide explains how to use the `sus-fixtures-async` gem to test async components in a reactor. ## Contributing We welcome contributions to this project. 1. Fork it. 2. Create your feature branch (`git checkout -b my-new-feature`). 3. Commit your changes (`git commit -am 'Add some feature'`). 4. Push to the branch (`git push origin my-new-feature`). 5. Create new Pull Request. ### Developer Certificate of Origin In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed. ### Community Guidelines This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers. sus-fixtures-async-0.2.0/data.tar.gz.sig0000444000004100000410000000060015152127710020151 0ustar www-datawww-data%Q@tY:9E 1U|=Q"cM<)lo(X&1{;JE|XC;Mo# @>gW7' @K([+Rlz|j6Z&UCF`U -& 9ƭRHzZA8,"O16%M-PXO?Fg`hf= â["` WSIج9vz[ >рW_)mA)unnQpcxVԕ"% O|L;/?ݮ˾9W-?u.- 8Ϗ;3m,Z\44.I/R0 mR\0CZoT`Tsus-fixtures-async-0.2.0/license.md0000644000004100000410000000207315152127710017304 0ustar www-datawww-data# MIT License Copyright, 2022-2024, by Samuel Williams. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. sus-fixtures-async-0.2.0/metadata.gz.sig0000444000004100000410000000060015152127710020233 0ustar www-datawww-data+>(ɯSZKL>_PaLo5xvHW/Н1i#΀rbQωbZZ-CY-=eUٮE/ *U\ۮ*2`,2.Hm1dSeLۃgy7I=?Opсѝ̓=M'!zAV us^D4:aP,ۣijzJ TEc0< O9|a+pn1'IDd>vہT-1 Sq A>Bd*SPF}x3(_xE]qqPnŠkU=S_պ/'B6?g 9N